Skip to content

Examples in Getting started guide outdated (won't compile with containerd 1.0.0-beta.0)  #1521

@rutsky

Description

@rutsky

Final example in Getting started with containerd won't compile:

# command-line-arguments
./tt.go:31: too many arguments in call to containerd.WithImageConfig
        have ("github.com/containerd/containerd/vendor/golang.org/x/net/context".Context, containerd.Image)
        want (containerd.Image)
./tt.go:31: not enough arguments in call to containerd.GenerateSpec
        have (containerd.SpecOpts)
        want ("context".Context, *containerd.Client, *"github.com/containerd/containerd/containers".Container, ...containerd.SpecOpts)

after fixing it with:

--- main.go_       2017-09-16 21:00:46.000000000 +0200
+++ main.go        2017-09-16 21:13:05.948365056 +0200
@@ -28,7 +28,7 @@
         }
         log.Printf("Successfully pulled %s image\n", image.Name())
 
-        spec, err := containerd.GenerateSpec(containerd.WithImageConfig(ctx, image))
+        spec, err := containerd.GenerateSpec(ctx, client, nil, containerd.WithImageConfig(image))
         if err != nil {
                 return err
         }

it fails at runtime with an error:

$ sudo ./main
2017/09/16 21:17:52 failed to resolve rootfs: could not resolve config

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions