From f0d44c8bc1fd4e120a185dc22a51995f61dee637 Mon Sep 17 00:00:00 2001 From: Maxime Petazzoni Date: Fri, 6 Dec 2013 10:43:54 -0800 Subject: [PATCH] Documentation about automatic bind-mount dir creation Docker-DCO-1.1-Signed-off-by: Maxime Petazzoni (github: mpetazzoni) --- docs/sources/reference/commandline/cli.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/sources/reference/commandline/cli.rst b/docs/sources/reference/commandline/cli.rst index f6318326e2..c00a97d5c4 100644 --- a/docs/sources/reference/commandline/cli.rst +++ b/docs/sources/reference/commandline/cli.rst @@ -1100,7 +1100,16 @@ using the container, but inside the current working directory. .. code-block:: bash - $ sudo docker run -p 127.0.0.1:80:8080 ubuntu 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 + + $ sudo docker run -p 127.0.0.1:80:8080 ubuntu bash This binds port ``8080`` of the container to port ``80`` on ``127.0.0.1`` of the host machine. :ref:`port_redirection` explains in detail how to manipulate ports