Docker Community Forums

Share and learn in the Docker community.

Container volumes from the Docker VM

I need to run a container that wants access a number of resources on the host, but these resources assume Docker is running natively on the host. In the case of Docker for Mac, that is not possible since the host itself is not running Docker. My first thought would be to create container volumes from the Docker VM. Is there a way to create container volumes that reference the Docker VM instead of the host?

Hi Jeremy,

Do you means Docker Host Level Volume? Or Operating System Level Volume? If you want Docker Host level volume, you might specify the container volumes as:

docker run -d -v :/data busybox

if you want to the Operating System Level Volume, you might specify,

docker run -d -v host_path:/data busybox

Well, Docker for Mac uses a VM to actually run Docker so /var/lib/docker is in the VM instead of my host Mac system. I want to be able to run a Docker container, from my host Mac that mounts a volume from within the Docker for Mac VM so that /var/lib/docker in my container maps to /var/lib/docker in the Docker for Mac VM. Did that clear things up?

I realize the first option you mentioned might be what I was hoping for. I’ll do a little digging on that.

That doesn’t seem to be the case. I get an error: Invalid volume specification I’ll keep digging.