How can i run docker command inside a docker container?

Just create a volume map for both the docker executable, and the docker socket descriptor…

docker run -it -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker ubuntu:latest bash

In your case, your image, and the command to run are up to you, but mapping those two pieces are enough to interact with the docker executable. :slight_smile:

5 Likes