Docker Community Forums

Share and learn in the Docker community.

Can I run Docker on a Ubuntu, Debian, or Fedora container, running in my Mac Docker?

I’ve tried following these instructions:



I can get through all installation procedures, but always fail “docker run hello-world” because
“docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.”

Is this related to a stacked install on Mac?

Did you try to install Docker for Ubuntu on your Mac?
This doesn’t work since your Mac is not Ubuntu and not even Linux anymore.

You need to install Docker Desktop for Mac

no. I was running Ubuntu, Fedora, and Debian in Docker containers on my Mac, with Docker Desktop.

I was trying to install docker on those instances. It failed everytime on every platform including AWS instances of Debian machines.

I installed virtualBox, and Debian 10 on that…and it works like a charm.

I presumed that containers were more/less vms, but apparently not.

Hi,

You can’t run docker directly inside a docker container.
But you can use the docker-cli to call the docker installed on your own machine.
Your docker container can start other container or manage it by passing as a volume the docker.sock

docker run -it -v /var/run/docker.sock:/var/run/docker.sock docker docker run -it --rm hello-world

here, you use the docker cli to start a contianer using the docker image, but you can use your custom one.
the -v allow you to pass files or directory of you own machine inside the container, here I use the docker socket because it allow the container to communicate to my host docker.
Just after the volume, I have “docker” this is the image name. You can use Ubuntu but you need to install docker-cli on it.
After the image name, I have my command. this dommand will run a docker image using the hello-world image.