mirror of https://github.com/docker/docs.git
Merge pull request #13141 from vieux/fallback_inspect
fallback to interface with docker inspect
This commit is contained in:
commit
d4eba30065
|
@ -59,7 +59,8 @@ func (cli *DockerCli) CmdInspect(args ...string) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dec := json.NewDecoder(bytes.NewReader(obj))
|
rdr := bytes.NewReader(obj)
|
||||||
|
dec := json.NewDecoder(rdr)
|
||||||
|
|
||||||
if isImage {
|
if isImage {
|
||||||
inspPtr := types.ImageInspect{}
|
inspPtr := types.ImageInspect{}
|
||||||
|
@ -69,7 +70,14 @@ func (cli *DockerCli) CmdInspect(args ...string) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err := tmpl.Execute(cli.out, inspPtr); err != nil {
|
if err := tmpl.Execute(cli.out, inspPtr); err != nil {
|
||||||
return err
|
rdr.Seek(0, 0)
|
||||||
|
var raw interface{}
|
||||||
|
if err := dec.Decode(&raw); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err = tmpl.Execute(cli.out, raw); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
inspPtr := types.ContainerJSON{}
|
inspPtr := types.ContainerJSON{}
|
||||||
|
@ -79,8 +87,14 @@ func (cli *DockerCli) CmdInspect(args ...string) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err := tmpl.Execute(cli.out, inspPtr); err != nil {
|
if err := tmpl.Execute(cli.out, inspPtr); err != nil {
|
||||||
return err
|
rdr.Seek(0, 0)
|
||||||
|
var raw interface{}
|
||||||
|
if err := dec.Decode(&raw); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err = tmpl.Execute(cli.out, raw); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cli.out.Write([]byte{'\n'})
|
cli.out.Write([]byte{'\n'})
|
||||||
|
|
Loading…
Reference in New Issue