Skip to content

Running with custom containerd snapshotterΒ #132

@ChanderG

Description

@ChanderG

So, I am trying to setup a Nomad in Docker kind of dev setup with containerd to run Nomad tasks. Due to the "containerd" on top "docker" situation, the default "overlayfs" snapshotter doesn't work.

With some effort, I have been able to get "fuse-overlayfs" working with containerd inside a docker container. So with some config and env variable updates (namely CONTAINERD_SNAPSHOTTER), I can pull images using ctr and run nerdctl without problems.

Now, I want to run containers via nomad -> nomad-driver-containerd -> containerd. With some experimentation, the only way I can get this to work is using the following patch:

--- a/containerd/containerd.go
+++ b/containerd/containerd.go
@@ -109,6 +109,7 @@ func (d *Driver) pullImage(imageName, imagePullTimeout string, auth *RegistryAut
 
 	pullOpts := []containerd.RemoteOpt{
 		containerd.WithPullUnpack,
+		containerd.WithPullSnapshotter("fuse-overlayfs"),
 		withResolver(d.parshAuth(auth)),
 	}
 
@@ -339,6 +340,7 @@ func (d *Driver) createContainer(containerConfig *ContainerConfig, config *TaskC
 	return d.client.NewContainer(
 		ctxWithTimeout,
 		containerConfig.ContainerName,
+		containerd.WithSnapshotter("fuse-overlayfs"),
 		containerd.WithRuntime(d.config.ContainerdRuntime, nil),
 		containerd.WithNewSnapshot(containerConfig.ContainerSnapshotName, containerConfig.Image),
 		containerd.WithNewSpec(opts...),

The image is pulled and the container started without issues, if I use the above version.

So, I have two questions:

  1. Am I missing something, or is this the only way to override the snapshotter setting? (I assumed that setting the default snapshotter in the containerd config would work, but it did not.)
  2. If this is the only way, would you accept a PR making the snapshotter configurable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions