How to mount a host directory in a Docker container

后端 未结 25 1700
庸人自扰
庸人自扰 2020-11-22 12:43

I am trying to mount a host directory into a Docker container so that any updates done on the host is reflected into the Docker containers.

Where am I doing somethin

25条回答
  •  庸人自扰
    2020-11-22 12:59

    Is it possible that you use docker on OS X via boot2docker or something similar.

    I've made the same experience - the command is correct but nothing (sensible) is mounted in the container, anyway.

    As it turns out - it's already explained in the docker documentation. When you type docker run -v /var/logs/on/host:/var/logs/in/container ... then /var/logs/on/host is actually mapped from the boot2docker VM-image, not your Mac.

    You'll have to pipe the shared folder through your VM to your actual host (the Mac in my case).

提交回复
热议问题