diff --git a/docs/sources/commandline/cli.rst b/docs/sources/commandline/cli.rst index 331311ffca..d0a8d83c0c 100644 --- a/docs/sources/commandline/cli.rst +++ b/docs/sources/commandline/cli.rst @@ -845,6 +845,13 @@ id may be optionally suffixed with ``:ro`` or ``:rw`` to mount the volumes in read-only or read-write mode, respectively. By default, the volumes are mounted in the same mode (rw or ro) as the reference container. +Known Issues (run -volumes-from) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* :issue:`2702`: "lxc-start: Permission denied - failed to mount" + could indicate a permissions problem with AppArmor. Please see the + issue for a workaround. + .. _cli_search: ``search`` diff --git a/docs/sources/use/working_with_volumes.rst b/docs/sources/use/working_with_volumes.rst index 3a06685e54..9156e574d0 100644 --- a/docs/sources/use/working_with_volumes.rst +++ b/docs/sources/use/working_with_volumes.rst @@ -30,44 +30,60 @@ Each container can have zero or more data volumes. Getting Started ............... - - -Using data volumes is as simple as adding a new flag: ``-v``. The parameter ``-v`` can be used more than once in order to create more volumes within the new container. The example below shows the instruction to create a container with two new volumes:: +Using data volumes is as simple as adding a new flag: ``-v``. The +parameter ``-v`` can be used more than once in order to create more +volumes within the new container. The example below shows the +instruction to create a container with two new volumes:: docker run -v /var/volume1 -v /var/volume2 shykes/couchdb -For a Dockerfile, the VOLUME instruction will add one or more new volumes to any container created from the image:: +For a Dockerfile, the VOLUME instruction will add one or more new +volumes to any container created from the image:: VOLUME ["/var/volume1", "/var/volume2"] -Create a new container using existing volumes from an existing container: ---------------------------------------------------------------------------- +Mount Volumes from an Existing Container: +----------------------------------------- - -The command below creates a new container which is running as daemon ``-d`` and with one volume ``/var/lib/couchdb``:: +The command below creates a new container which is runnning as daemon +``-d`` and with one volume ``/var/lib/couchdb``:: COUCH1=$(sudo docker run -d -v /var/lib/couchdb shykes/couchdb:2013-05-03) -From the container id of that previous container ``$COUCH1`` it's possible to create new container sharing the same volume using the parameter ``-volumes-from container_id``:: +From the container id of that previous container ``$COUCH1`` it's +possible to create new container sharing the same volume using the +parameter ``-volumes-from container_id``:: COUCH2=$(sudo docker run -d -volumes-from $COUCH1 shykes/couchdb:2013-05-03) Now, the second container has the all the information from the first volume. -Create a new container which mounts a host directory into it: -------------------------------------------------------------- +Mount a Host Directory as a Container Volume: +--------------------------------------------- + +:: -v=[]: Create a bind mount with: [host-dir]:[container-dir]:[rw|ro]. If "host-dir" is missing, then docker creates a new volume. - This is not available for a Dockerfile due the portability and sharing purpose of it. The [host-dir] volumes is something 100% host dependent and will break on any other machine. +This is not available for a Dockerfile due the portability and sharing +purpose of it. The [host-dir] volumes is something 100% host dependent +and will break on any other machine. For example:: sudo docker run -v /var/logs:/var/host_logs:ro shykes/couchdb:2013-05-03 -The command above mounts the host directory ``/var/logs`` into the container with read only permissions as ``/var/host_logs``. +The command above mounts the host directory ``/var/logs`` into the +container with read only permissions as ``/var/host_logs``. .. versionadded:: v0.5.0 + +Known Issues +............ + +* :issue:`2702`: "lxc-start: Permission denied - failed to mount" + could indicate a permissions problem with AppArmor. Please see the + issue for a workaround.