mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
'docker inspect' can be used on images and containers
This commit is contained in:
parent
49da84d7c4
commit
1b898574cf
1 changed files with 18 additions and 13 deletions
|
@ -200,8 +200,15 @@ func (srv *Server) CmdInspect(stdin io.ReadCloser, stdout io.Writer, args ...str
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
name := cmd.Arg(0)
|
name := cmd.Arg(0)
|
||||||
|
var obj interface{}
|
||||||
if container := srv.containers.Get(name); container != nil {
|
if container := srv.containers.Get(name); container != nil {
|
||||||
data, err := json.Marshal(container)
|
obj = container
|
||||||
|
} else if image := srv.images.Find(name); image != nil {
|
||||||
|
obj = image
|
||||||
|
} else {
|
||||||
|
return errors.New("No such container or image: " + name)
|
||||||
|
}
|
||||||
|
data, err := json.Marshal(obj)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -214,8 +221,6 @@ func (srv *Server) CmdInspect(stdin io.ReadCloser, stdout io.Writer, args ...str
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return errors.New("No such container: " + name)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (srv *Server) CmdRm(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
|
func (srv *Server) CmdRm(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
|
||||||
flags := rcli.Subcmd(stdout, "rm", "[OPTIONS] CONTAINER", "Remove a container")
|
flags := rcli.Subcmd(stdout, "rm", "[OPTIONS] CONTAINER", "Remove a container")
|
||||||
|
|
Loading…
Reference in a new issue