mirror of https://github.com/docker/docs.git
Merge pull request #2719 from metalivedev/2702-knownissue-lxc-start-failed-to-mount
Fixes #2702. Also cleans up formatting and long lines in volumes doc.
This commit is contained in:
commit
1de02a70de
|
@ -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
|
read-only or read-write mode, respectively. By default, the volumes are mounted
|
||||||
in the same mode (rw or ro) as the reference container.
|
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:
|
.. _cli_search:
|
||||||
|
|
||||||
``search``
|
``search``
|
||||||
|
|
|
@ -30,44 +30,60 @@ Each container can have zero or more data volumes.
|
||||||
Getting Started
|
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
|
||||||
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::
|
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
|
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"]
|
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 runnning as daemon
|
||||||
The command below creates a new container which is running as daemon ``-d`` and with one volume ``/var/lib/couchdb``::
|
``-d`` and with one volume ``/var/lib/couchdb``::
|
||||||
|
|
||||||
COUCH1=$(sudo docker run -d -v /var/lib/couchdb shykes/couchdb:2013-05-03)
|
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)
|
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.
|
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].
|
-v=[]: Create a bind mount with: [host-dir]:[container-dir]:[rw|ro].
|
||||||
If "host-dir" is missing, then docker creates a new volume.
|
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::
|
For example::
|
||||||
|
|
||||||
sudo docker run -v /var/logs:/var/host_logs:ro shykes/couchdb:2013-05-03
|
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
|
.. 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.
|
||||||
|
|
Loading…
Reference in New Issue