Documentation about automatic bind-mount dir creation

Docker-DCO-1.1-Signed-off-by: Maxime Petazzoni <max@signalfuse.com> (github: mpetazzoni)
This commit is contained in:
Maxime Petazzoni 2013-12-06 10:43:54 -08:00 committed by Tibor Vass
parent 632263387f
commit f0d44c8bc1
1 changed files with 10 additions and 1 deletions

View File

@ -1098,6 +1098,15 @@ working directory, by changing into the directory to the value
returned by ``pwd``. So this combination executes the command returned by ``pwd``. So this combination executes the command
using the container, but inside the current working directory. using the container, but inside the current working directory.
.. code-block:: bash
$ sudo docker run -v /dont/exist:/foo -w /foo -i -t ubuntu bash
When the host directory of a bind-mounted volume doesn't exist, Docker
will automatically create this directory on the host for you. In the
example above, Docker will create the ``/dont/exist`` folder before
starting your container.
.. code-block:: bash .. code-block:: bash
$ sudo docker run -p 127.0.0.1:80:8080 ubuntu bash $ sudo docker run -p 127.0.0.1:80:8080 ubuntu bash