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:
- use a container that has the
docker cliinstalled. Adockerfilefor that
FROM debian
RUN apt-get update && apt-get install wget -y
RUN wget https://get.docker.io/builds/Linux/x86_64/docker-latest -O /bin/docker
RUN chmod +x /bin/docker
-
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 -
The user in the container must have rights to use the socket. For
rootthere is no problem but to enable it for for other users, usechmod