Add ctr c info --spec flag to output spec
This flag makes it easy to view only the OCI spec for the container.
@@ -248,6 +248,12 @@ var infoCommand = cli.Command{
Name: "info",
Usage: "get info about a container",
ArgsUsage: "CONTAINER",
+ Flags: []cli.Flag{
+ cli.BoolFlag{
+ Name: "spec",
+ Usage: "only display the spec",
+ },
+ },
Action: func(context *cli.Context) error {
id := context.Args().First()
if id == "" {
@@ -266,6 +272,14 @@ var infoCommand = cli.Command{
if err != nil {
return err
}
+ if context.Bool("spec") {
+ v, err := typeurl.UnmarshalAny(info.Spec)
+ if err != nil {
+ return err
+ }
+ commands.PrintAsJSON(v)
+ return nil
+ }
if info.Spec != nil && info.Spec.Value != nil {
v, err := typeurl.UnmarshalAny(info.Spec)
