mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Detect images/containers conflicts in docker inspect
This commit is contained in:
parent
908bb65dcf
commit
5ec2fea6dd
3 changed files with 13 additions and 1 deletions
10
api.go
10
api.go
|
@ -819,6 +819,11 @@ func getContainersByName(srv *Server, version float64, w http.ResponseWriter, r
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = srv.ImageInspect(name)
|
||||
if err == nil {
|
||||
return fmt.Errorf("Conflict between containers and images")
|
||||
}
|
||||
b, err := json.Marshal(container)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -837,6 +842,11 @@ func getImagesByName(srv *Server, version float64, w http.ResponseWriter, r *htt
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = srv.ContainerInspect(name)
|
||||
if err == nil {
|
||||
return fmt.Errorf("Conflict between containers and images")
|
||||
}
|
||||
b, err := json.Marshal(image)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -577,7 +577,7 @@ func (cli *DockerCli) CmdInspect(args ...string) error {
|
|||
if err != nil {
|
||||
obj, _, err = cli.call("GET", "/images/"+name+"/json", nil)
|
||||
if err != nil {
|
||||
fmt.Fprintf(cli.err, "%s\n", err)
|
||||
fmt.Fprintf(cli.err, "No such image or container: %s\n", name)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
|
|
@ -224,6 +224,7 @@ Inspect a container
|
|||
|
||||
:statuscode 200: no error
|
||||
:statuscode 404: no such container
|
||||
:statuscode 409: conflict between containers and images
|
||||
:statuscode 500: server error
|
||||
|
||||
|
||||
|
@ -760,6 +761,7 @@ Inspect an image
|
|||
|
||||
:statuscode 200: no error
|
||||
:statuscode 404: no such image
|
||||
:statuscode 409: conflict between containers and images
|
||||
:statuscode 500: server error
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue