File tree Expand file tree Collapse file tree
cmd/ctr/commands/containers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,9 @@ import (
2828 "github.com/containerd/containerd/cio"
2929 "github.com/containerd/containerd/cmd/ctr/commands"
3030 "github.com/containerd/containerd/cmd/ctr/commands/run"
31+ "github.com/containerd/containerd/containers"
3132 "github.com/containerd/containerd/log"
33+ "github.com/containerd/typeurl"
3234 "github.com/urfave/cli"
3335)
3436
@@ -261,8 +263,22 @@ var infoCommand = cli.Command{
261263 if err != nil {
262264 return err
263265 }
264- commands .PrintAsJSON (info )
265266
267+ if info .Spec != nil && info .Spec .Value != nil {
268+ v , err := typeurl .UnmarshalAny (info .Spec )
269+ if err != nil {
270+ return err
271+ }
272+ commands .PrintAsJSON (struct {
273+ containers.Container
274+ Spec interface {} `json:"Spec,omitempty"`
275+ }{
276+ Container : info ,
277+ Spec : v ,
278+ })
279+ return nil
280+ }
281+ commands .PrintAsJSON (info )
266282 return nil
267283 },
268284}
You can’t perform that action at this time.
0 commit comments