Using containerd (and not Docker) with BinderHub
See original GitHub issueDocker is deprecated as a container runtime in Kubernetes 1.20. For those who are switching to a different container runtime, we need a different solution for running repo2docker.
There are some documentation on using Docker-in-Docker, but from what I can tell it doesn’t work with containerd as the container runtime (at least, not with the current helm chart, which mounts dockersocket-host
into the dind pod).
I’ve tested on Kubernetes 1.20.0 with containerd 1.4.3 and no Docker, and either the build pod (without DinD) or the DinD pod (with DinD) are not ready because Kubernetes can’t mount /var/run/docker.sock
into the pod.
Is there a particular reason why DinD needs access to the host docker.sock
? Can DinD run in containerd instead of Docker? I can do some testing if needed.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (11 by maintainers)
I’ve gotten binder to work with dind on top of containerd. Building and spawning images work, and I tested Thebe with it as well.
I did notice because dind and host containerd do not share an image cache, the image has to be pushed to the registry and repulled using the actual container runtime on the same host, which can be a bit slow during the first spawn. Other than that, I don’t feel any differences using this binderhub and one running on top of docker (it’s running at https://binder.galaxy.rkevin.dev, feel free to try it if you want).
I think it’s nice to add the following to the documentation:
If you are using containerd / CRI-O / some container runtime other than Docker, you must do the following:
dind.enabled
.dind.daemonset.extraArgs
. If yourapt update
during builds just hangs as if the remote server is not responding, definitely double check this. (I’m using Calico as the CNI plugin, and I needed to set a smaller MTU.)imageCleaner.host.enabled
to be false.Relevant parts of my helm values:
Update 3: The tl;dr for the following is depending on your networking, you should set a smaller MTU for the dind docker daemon. I did the following and it solved the issue:
See also: this.
Original comment:
Experiencing some really really weird stuff in the build container. I was able to manually run commands in the docker container being built by using
kubectl exec
to get a shell in thedind
container, then usingdocker -H /run/dind/docker.sock
to find the container currently being built and exec into it. Both networking and DNS seem to work properly, which is really weird. This also happened:Basically if I curl
archive.ubuntu.com
, it resolves to91.189.88.142
and was able to access the webpage. If I curl91.189.88.142:80
inside the build container, it hangs forever. This makes no sense to me, and I confirmed in the dind pod / host / my own machine thatcurl -v 91.189.88.142:80
should work as well. It’s only in the currently building Docker container that it has this issue.The exact output repo2docker gives (after hanging for a very long time):
I’ll dig around more and see if there’s anything I can find. If we can get dind working in containerd, it would be a great temporary solution until repo2docker stops relying on
docker build
Update:
curl -v http://archive.ubuntu.com/ubuntu/
hangs in the container being built, but not in the dind container itself. Can replicate using the following Dockerfile:Meanwhile
curl -v http://archive.ubuntu.com/ubuntu
andcurl -v http://archive.ubuntu.com/
both work. This is very weird.Update 2: It might be a MTU issue. (By the way, apologies for spamming this thread, I hope other people will find this useful but I’m not sure if this is getting off topic)