Mounting directory from host machine to container in Docker

Pavel Nuzhdin picture Pavel Nuzhdin · Mar 28, 2013 · Viewed 39.9k times · Source

How do I mount a directory from the host machine to a container in Docker?

Answer

user2089674 picture user2089674 · Sep 27, 2013

Just as a final update, this feature is now released in Docker (though the API has changed since the pull request linked by @imiric).

Simply use a command like

docker run -v /tmp:/root myImage

in order to mount /tmp from the host machine as /root within the image.

Source: https://docs.docker.com/engine/userguide/dockervolumes/