Running docker inside Kubernetes with containerd

11/22/2018

Since K8S v1.11 Runtime was changed from dockerd to containerd. I'm using Jenkins over kubernetes to build docker images using Docker outside of Docker (dood).

When I tried to switch to use the socket file from conatinerd (containerd/containerd.sock was mapped ad /var/run/docker.sock) with the regular docker client a got the following error Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/json: net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x00\x00\x00\x04\x00\x00\x00\x00\x00".

Can docker client be used with containerd?

-- Yuri Ritvin
containerd
dind
docker
kubernetes

1 Answer

11/22/2018

Disclaimer: as of this writing containerd didn't replace Docker, you can install containerd separately from Docker, and you can point the Kubernetes CRI to directly talk to the containerd socket.

So, when you install Docker it does install together with containerd and the Docker daemon talks to it. You'll see a process like this:

docker-containerd --config /var/run/docker/containerd/containerd.toml

However, the Docker client still talks to the Docker daemon, that's why when you run the Docker client in your container you still need to talk directly to the Docker daemon (/var/run/docker.sock), so you can switch back to /var/run/docker.sock and I believe it should work.

-- Rico
Source: StackOverflow