diff --git a/cmd/ctr/snapshot.go b/cmd/ctr/snapshot.go index 400a9eb8c..46f2e9b1a 100644 --- a/cmd/ctr/snapshot.go +++ b/cmd/ctr/snapshot.go @@ -28,6 +28,7 @@ var snapshotCommand = cli.Command{ prepareSnapshotCommand, treeSnapshotCommand, mountSnapshotCommand, + commitSnapshotCommand, }, } @@ -290,6 +291,30 @@ var mountSnapshotCommand = cli.Command{ }, } +var commitSnapshotCommand = cli.Command{ + Name: "commit", + Usage: "commit creates a new snapshot with diff from parent snapshot", + ArgsUsage: "[flags] ", + Action: func(clicontext *cli.Context) error { + ctx, cancel := appContext(clicontext) + defer cancel() + + if clicontext.NArg() != 2 { + return cli.ShowSubcommandHelp(clicontext) + } + + id := clicontext.Args().Get(0) + target := clicontext.Args().Get(1) + + snapshotter, err := getSnapshotter(clicontext) + if err != nil { + return err + } + + return snapshotter.Commit(ctx, target, id) + }, +} + var treeSnapshotCommand = cli.Command{ Name: "tree", Usage: "Display tree view of snapshot branches",