Skip to content

Commit

Permalink
Merge pull request #2719 from metalivedev/2702-knownissue-lxc-start-f…
Browse files Browse the repository at this point in the history
…ailed-to-mount

Fixes #2702. Also cleans up formatting and long lines in volumes doc.
  • Loading branch information
metaliveblog committed Nov 19, 2013
2 parents 511a62a + 2ae1f29 commit 1de02a7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 13 deletions.
7 changes: 7 additions & 0 deletions docs/sources/commandline/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``
Expand Down
42 changes: 29 additions & 13 deletions docs/sources/use/working_with_volumes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 1de02a7

Please sign in to comment.