Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Docker in docker
One way to enable a docker container to use docker, is to pass the socket for the docker daemon to the container. To make it work you need to:
1. use a container that has the docker cli installed. A dockerfile for that
FROM debian
RUN apt-get update && apt-get install wget -y
RUN wget -O /bin/docker
RUN chmod +x /bin/docker
2. mount the docker daemon socket when the container is started docker
run -it --rm -v /var/run/docker.sock:/var/run/docker.sock myDockerEnabledImage bash
3. The user in the container must have rights to use the socket. For root there is no problem but to enable it for for other users, use chmod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment