Testing #Docker with #containerd image store without Docker Desktop

With the release of the prerelease versions for Docker 24.0.0, a feature flag was added to enable the containerd image store. This extends the integration of Docker with containerd by delegating image operations. This post dives into setting up the new version of Docker and enabling the containerd image store.

Disclaimer: Only test the new version of Docker on a dedicated machine.

Download and install the release candidate of Docker 24.0.0 and unpack it to /usr/local/bin. At the time of this writing, 24.0.0-rc.2 is the latest version.

curl --silent --location \
  --url https://download.docker.com/linux/static/test/x86_64/docker-24.0.0-rc.2.tgz \
| tar --extract --gzip --directory=/usr/local/bin --strip-components=1

The containerd image store is enabled by setting the feature containerd-snapshotter:

mkdir /etc/docker
cat <<EOF >/etc/docker/daemon.json
{
  "features": {
    "containerd-snapshotter": true
  }
}
EOF

The following command starts Docker in the background and writes the log to /var/log/docker.log:

dockerd >>/var/log/docker.log 2>&1 &

First you should make sure that client and daemon are in fact running version 24.0.0-rc.2 and that the driver-type contains io.containerd.snapshotter.v1:

$ docker info
Client:
 Version:    24.0.0-rc.2
 Context:    default
 Debug Mode: false

Server:
 Containers: 2
  Running: 0
  Paused: 0
  Stopped: 2
 Images: 1
 Server Version: 24.0.0-rc.2
 Storage Driver: overlayfs
  driver-type: io.containerd.snapshotter.v1
#...

The next command tells Docker to download a container image and run a container using the containerd image store:

docker container run -it alpine true

The effect of the above command is best investigated in containerd. Docker is using a namespace called moby in containerd (see output of first command below). The image pulled by the above run command is stored inside this namespace and can be displayed using the second command below.

ctr --address /var/run/docker/containerd/containerd.sock \
    namespace list
ctr --address /var/run/docker/containerd/containerd.sock --namespace moby \
    images list

More tests can be performed by running docker image pull as well as docker image rm and then checking the contents of the image store in containerd.

Feedback is always welcome! If you'd like to get in touch with me concerning the contents of this article, please use Twitter.