Use Docker from inside a Docker container

Fascinatedly I found a little gem on the Docker forums! You can run docker inside a Docker container without running an own instance of the Docker daemon inside the container. With a simple hack you can use the host’s daemon inside the container!

How? Just host the Docker unix socket as a volume into the container! It’s clever!

Example from the forums:

docker run -it -v /var/run/docker.sock:/var/run/docker.sock ubuntu:latest sh -c "apt-get update ; apt-get install docker.io -y ; bash"

Reference: Run docker inside a docker container

Leave a Reply