Docker Community Forums

Share and learn in the Docker community.

Running Docker Command in a Docker Container


I am running a Docker 17.12.0-ce on an Ubuntu 16.04 VM.
I have installed Microsoft Azure-CLI Docker Container.
Once I launch the Azure-CLI container in interactive mode, mapping the volumes with
“docker run -it -v /var/run/docker.sock:/var/run/docker.sock -v /var/run/docker:/var/run/docker microsoft/azure-cli bash”
I would like to run some docker commands inside the Azure-CLI Container, ( for example docker login, docker pull, etc…)
However, I get “docker: command not found” once in the docker container.

How could I run docker commands inside a docker container?

Thank you

(Gary Forghetti) #2

Check out this post -> Docker Container Get IP Address from host interfaces


Thanks for the reply.
Is there any other option than installing Docker on a Docker container?


(Gary Forghetti) #4

Hi Jon.

I’ve heard others have tried other mechanisms like ssh etc.

Keep in mind although you are installing Docker in a Docker container, the docker daemon is not running in the container. You are just using the docker client in the container to talk over the shared docker unix socket to the Docker Node where the docker daemon is running.