Skip to content

Commit db22760

Browse files
authored
Merge pull request #73 from thin-edge/docs-add-container-install-example
feat(container): add examples for installing and removing a container
2 parents 6780a75 + eb681a4 commit db22760

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

cli/container/install.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,21 @@ func NewInstallCommand(ctx cli.Cli) *cobra.Command {
4242
cmd := &cobra.Command{
4343
Use: "install <MODULE_NAME>",
4444
Short: "Install/run a container",
45-
Args: cobra.ExactArgs(1),
46-
RunE: command.RunE,
45+
Example: `
46+
Example 1: Install a container and pull in the image from any available registries
47+
48+
$ tedge-container container install myapp1 --module-version docker.io/nginx:latest
49+
50+
51+
Example 2: Save an image (using an explicit platform) and install/create a container with the saved image file
52+
53+
$ docker pull --platform linux/arm64 docker.io/nginx:latest
54+
$ docker save docker.io/nginx:latest > nginx:latest.tar
55+
$ gzip nginx:latest.tar
56+
$ tedge-container container install myapp1 --module-version nginx:latest --file ./nginx:latest.tar.gz
57+
`,
58+
Args: cobra.ExactArgs(1),
59+
RunE: command.RunE,
4760
}
4861

4962
cmd.Flags().StringVar(&command.ModuleVersion, "module-version", "", "Software version to install")

cli/container/remove.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ func NewRemoveCommand(ctx cli.Cli) *cobra.Command {
2424
cmd := &cobra.Command{
2525
Use: "remove",
2626
Short: "Remove a container",
27-
Args: cobra.ExactArgs(1),
27+
Example: `
28+
Example 1: Remove a container
29+
30+
$ tedge-container container remove myapp1
31+
`,
32+
Args: cobra.ExactArgs(1),
2833
RunE: func(cmd *cobra.Command, args []string) error {
2934
slog.Info("Executing", "cmd", cmd.CalledAs(), "args", args)
3035
ctx := context.Background()

0 commit comments

Comments
 (0)