How to create a volume from a local path in a Dockerfile?

With command line arguments, I can indicate that I want to mount a local directory as a volume:

docker run -i -t -v /path/to/directory/:/mount/point testimage

However, I can’t find anything to describe the syntax to VOLUME in a Dockerfile to do the same thing. Can anyone explain what this looks like?

  • Weird behaviour of boto inside docker
  • Command to Copy/share jmeter master container results (Docker) generated in by running the script in non-gui mode to EC2 instance
  • how to determine whether a given docker environment is based on libcontainer or lxe
  • Docker - Handling multiple services in a single container
  • sbt-docker invalid header field value "oci… runtime error: no such file error
  • How does one detect if one is running within a docker container within Python?
  • Docker - get veth interface name of a container by name / id
  • Docker Windows 8 issue - containers not loading after restart
  • Docker - cannot connect to the Docker daemon
  • docker mysql persistent storage
  • how to import large file in a local cartodb running in a docker container
  • Link between two docker containers in a network
  • One Solution collect form web for “How to create a volume from a local path in a Dockerfile?”

    Dockerfiles only define the right side (which paths within the container are volumes) — not the local/left side.

    The mapping is done during container creation, not image creation.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.