mirror of https://github.com/docker/docs.git
storage: use "console" for shell examples
This allows for easier copying of the commands, without selecting the prompt. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
051a690f64
commit
4afcaf3b2d
|
@ -103,7 +103,7 @@ first one.
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div id="mount-run" class="tab-pane fade in active" markdown="1">
|
<div id="mount-run" class="tab-pane fade in active" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
-it \
|
-it \
|
||||||
--name devtest \
|
--name devtest \
|
||||||
|
@ -114,7 +114,7 @@ $ docker run -d \
|
||||||
</div><!--mount-->
|
</div><!--mount-->
|
||||||
<div id="v-run" class="tab-pane fade" markdown="1">
|
<div id="v-run" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
-it \
|
-it \
|
||||||
--name devtest \
|
--name devtest \
|
||||||
|
@ -147,7 +147,7 @@ set to `rprivate`.
|
||||||
|
|
||||||
Stop the container:
|
Stop the container:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker container stop devtest
|
$ docker container stop devtest
|
||||||
|
|
||||||
$ docker container rm devtest
|
$ docker container rm devtest
|
||||||
|
@ -174,7 +174,7 @@ The `--mount` and `-v` examples have the same end result.
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div id="mount-empty-run" class="tab-pane fade in active" markdown="1">
|
<div id="mount-empty-run" class="tab-pane fade in active" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
-it \
|
-it \
|
||||||
--name broken-container \
|
--name broken-container \
|
||||||
|
@ -188,7 +188,7 @@ starting container process caused "exec: \"nginx\": executable file not found in
|
||||||
</div><!--mount-->
|
</div><!--mount-->
|
||||||
<div id="v-empty-run" class="tab-pane fade" markdown="1">
|
<div id="v-empty-run" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
-it \
|
-it \
|
||||||
--name broken-container \
|
--name broken-container \
|
||||||
|
@ -204,7 +204,7 @@ starting container process caused "exec: \"nginx\": executable file not found in
|
||||||
|
|
||||||
The container is created but does not start. Remove it:
|
The container is created but does not start. Remove it:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker container rm broken-container
|
$ docker container rm broken-container
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ The `--mount` and `-v` examples have the same result.
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div id="mount-readonly" class="tab-pane fade in active" markdown="1">
|
<div id="mount-readonly" class="tab-pane fade in active" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
-it \
|
-it \
|
||||||
--name devtest \
|
--name devtest \
|
||||||
|
@ -239,7 +239,7 @@ $ docker run -d \
|
||||||
</div><!--mount-->
|
</div><!--mount-->
|
||||||
<div id="v-readonly" class="tab-pane fade" markdown="1">
|
<div id="v-readonly" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
-it \
|
-it \
|
||||||
--name devtest \
|
--name devtest \
|
||||||
|
@ -268,7 +268,7 @@ correctly. Look for the `Mounts` section:
|
||||||
|
|
||||||
Stop the container:
|
Stop the container:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker container stop devtest
|
$ docker container stop devtest
|
||||||
|
|
||||||
$ docker container rm devtest
|
$ docker container rm devtest
|
||||||
|
@ -316,7 +316,7 @@ The `--mount` and `-v` examples have the same result.
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div id="mount-propagation" class="tab-pane fade in active" markdown="1">
|
<div id="mount-propagation" class="tab-pane fade in active" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
-it \
|
-it \
|
||||||
--name devtest \
|
--name devtest \
|
||||||
|
@ -328,7 +328,7 @@ $ docker run -d \
|
||||||
</div><!--mount-->
|
</div><!--mount-->
|
||||||
<div id="v-propagation" class="tab-pane fade" markdown="1">
|
<div id="v-propagation" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
-it \
|
-it \
|
||||||
--name devtest \
|
--name devtest \
|
||||||
|
@ -367,7 +367,7 @@ the bind mount's contents:
|
||||||
|
|
||||||
It is not possible to modify the selinux label using the `--mount` flag.
|
It is not possible to modify the selinux label using the `--mount` flag.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
-it \
|
-it \
|
||||||
--name devtest \
|
--name devtest \
|
||||||
|
|
|
@ -37,7 +37,7 @@ storage driver is configured, Docker uses it by default.
|
||||||
|
|
||||||
1. Use the following command to verify that your kernel supports AUFS.
|
1. Use the following command to verify that your kernel supports AUFS.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ grep aufs /proc/filesystems
|
$ grep aufs /proc/filesystems
|
||||||
|
|
||||||
nodev aufs
|
nodev aufs
|
||||||
|
@ -45,7 +45,7 @@ storage driver is configured, Docker uses it by default.
|
||||||
|
|
||||||
2. Check which storage driver Docker is using.
|
2. Check which storage driver Docker is using.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker info
|
$ docker info
|
||||||
|
|
||||||
<truncated output>
|
<truncated output>
|
||||||
|
@ -88,7 +88,7 @@ minimize overhead.
|
||||||
The following `docker pull` command shows a Docker host downloading a Docker
|
The following `docker pull` command shows a Docker host downloading a Docker
|
||||||
image comprising five layers.
|
image comprising five layers.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker pull ubuntu
|
$ docker pull ubuntu
|
||||||
|
|
||||||
Using default tag: latest
|
Using default tag: latest
|
||||||
|
|
|
@ -41,7 +41,7 @@ Btrfs Filesystem as Btrfs.
|
||||||
- `btrfs` support must exist in your kernel. To check this, run the following
|
- `btrfs` support must exist in your kernel. To check this, run the following
|
||||||
command:
|
command:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ grep btrfs /proc/filesystems
|
$ grep btrfs /proc/filesystems
|
||||||
|
|
||||||
btrfs
|
btrfs
|
||||||
|
@ -60,7 +60,7 @@ This procedure is essentially identical on SLES and Ubuntu.
|
||||||
2. Copy the contents of `/var/lib/docker/` to a backup location, then empty
|
2. Copy the contents of `/var/lib/docker/` to a backup location, then empty
|
||||||
the contents of `/var/lib/docker/`:
|
the contents of `/var/lib/docker/`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo cp -au /var/lib/docker /var/lib/docker.bk
|
$ sudo cp -au /var/lib/docker /var/lib/docker.bk
|
||||||
$ sudo rm -rf /var/lib/docker/*
|
$ sudo rm -rf /var/lib/docker/*
|
||||||
```
|
```
|
||||||
|
@ -70,7 +70,7 @@ This procedure is essentially identical on SLES and Ubuntu.
|
||||||
`/dev/xvdg`. Double-check the block device names because this is a
|
`/dev/xvdg`. Double-check the block device names because this is a
|
||||||
destructive operation.
|
destructive operation.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo mkfs.btrfs -f /dev/xvdf /dev/xvdg
|
$ sudo mkfs.btrfs -f /dev/xvdf /dev/xvdg
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ This procedure is essentially identical on SLES and Ubuntu.
|
||||||
4. Mount the new Btrfs filesystem on the `/var/lib/docker/` mount point. You
|
4. Mount the new Btrfs filesystem on the `/var/lib/docker/` mount point. You
|
||||||
can specify any of the block devices used to create the Btrfs filesystem.
|
can specify any of the block devices used to create the Btrfs filesystem.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo mount -t btrfs /dev/xvdf /var/lib/docker
|
$ sudo mount -t btrfs /dev/xvdf /var/lib/docker
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ This procedure is essentially identical on SLES and Ubuntu.
|
||||||
|
|
||||||
5. Copy the contents of `/var/lib/docker.bk` to `/var/lib/docker/`.
|
5. Copy the contents of `/var/lib/docker.bk` to `/var/lib/docker/`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo cp -au /var/lib/docker.bk/* /var/lib/docker/
|
$ sudo cp -au /var/lib/docker.bk/* /var/lib/docker/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ This procedure is essentially identical on SLES and Ubuntu.
|
||||||
7. Start Docker. After it is running, verify that `btrfs` is being used as the
|
7. Start Docker. After it is running, verify that `btrfs` is being used as the
|
||||||
storage driver.
|
storage driver.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker info
|
$ docker info
|
||||||
|
|
||||||
Containers: 0
|
Containers: 0
|
||||||
|
@ -140,7 +140,7 @@ roughly 1 GB.
|
||||||
To add a block device to a Btrfs volume, use the `btrfs device add` and
|
To add a block device to a Btrfs volume, use the `btrfs device add` and
|
||||||
`btrfs filesystem balance` commands.
|
`btrfs filesystem balance` commands.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo btrfs device add /dev/svdh /var/lib/docker
|
$ sudo btrfs device add /dev/svdh /var/lib/docker
|
||||||
|
|
||||||
$ sudo btrfs filesystem balance /var/lib/docker
|
$ sudo btrfs filesystem balance /var/lib/docker
|
||||||
|
|
|
@ -57,7 +57,7 @@ For production systems, see
|
||||||
|
|
||||||
1. Stop Docker.
|
1. Stop Docker.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo systemctl stop docker
|
$ sudo systemctl stop docker
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -77,14 +77,14 @@ For production systems, see
|
||||||
|
|
||||||
3. Start Docker.
|
3. Start Docker.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo systemctl start docker
|
$ sudo systemctl start docker
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Verify that the daemon is using the `devicemapper` storage driver. Use the
|
4. Verify that the daemon is using the `devicemapper` storage driver. Use the
|
||||||
`docker info` command and look for `Storage Driver`.
|
`docker info` command and look for `Storage Driver`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker info
|
$ docker info
|
||||||
|
|
||||||
Containers: 0
|
Containers: 0
|
||||||
|
@ -204,7 +204,7 @@ assumes that the Docker daemon is in the `stopped` state.
|
||||||
|
|
||||||
2. Stop Docker.
|
2. Stop Docker.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo systemctl stop docker
|
$ sudo systemctl stop docker
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ assumes that the Docker daemon is in the `stopped` state.
|
||||||
> **Warning**: The next few steps are destructive, so be sure that you have
|
> **Warning**: The next few steps are destructive, so be sure that you have
|
||||||
> specified the correct device!
|
> specified the correct device!
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo pvcreate /dev/xvdf
|
$ sudo pvcreate /dev/xvdf
|
||||||
|
|
||||||
Physical volume "/dev/xvdf" successfully created.
|
Physical volume "/dev/xvdf" successfully created.
|
||||||
|
@ -231,7 +231,7 @@ assumes that the Docker daemon is in the `stopped` state.
|
||||||
5. Create a `docker` volume group on the same device, using the `vgcreate`
|
5. Create a `docker` volume group on the same device, using the `vgcreate`
|
||||||
command.
|
command.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo vgcreate docker /dev/xvdf
|
$ sudo vgcreate docker /dev/xvdf
|
||||||
|
|
||||||
Volume group "docker" successfully created
|
Volume group "docker" successfully created
|
||||||
|
@ -242,7 +242,7 @@ assumes that the Docker daemon is in the `stopped` state.
|
||||||
to allow for automatic expanding of the data or metadata if space runs low,
|
to allow for automatic expanding of the data or metadata if space runs low,
|
||||||
as a temporary stop-gap. These are the recommended values.
|
as a temporary stop-gap. These are the recommended values.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo lvcreate --wipesignatures y -n thinpool docker -l 95%VG
|
$ sudo lvcreate --wipesignatures y -n thinpool docker -l 95%VG
|
||||||
|
|
||||||
Logical volume "thinpool" created.
|
Logical volume "thinpool" created.
|
||||||
|
@ -255,7 +255,7 @@ assumes that the Docker daemon is in the `stopped` state.
|
||||||
7. Convert the volumes to a thin pool and a storage location for metadata for
|
7. Convert the volumes to a thin pool and a storage location for metadata for
|
||||||
the thin pool, using the `lvconvert` command.
|
the thin pool, using the `lvconvert` command.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo lvconvert -y \
|
$ sudo lvconvert -y \
|
||||||
--zero n \
|
--zero n \
|
||||||
-c 512K \
|
-c 512K \
|
||||||
|
@ -270,7 +270,7 @@ assumes that the Docker daemon is in the `stopped` state.
|
||||||
|
|
||||||
8. Configure autoextension of thin pools via an `lvm` profile.
|
8. Configure autoextension of thin pools via an `lvm` profile.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo vi /etc/lvm/profile/docker-thinpool.profile
|
$ sudo vi /etc/lvm/profile/docker-thinpool.profile
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ assumes that the Docker daemon is in the `stopped` state.
|
||||||
|
|
||||||
10. Apply the LVM profile, using the `lvchange` command.
|
10. Apply the LVM profile, using the `lvchange` command.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo lvchange --metadataprofile docker-thinpool docker/thinpool
|
$ sudo lvchange --metadataprofile docker-thinpool docker/thinpool
|
||||||
|
|
||||||
Logical volume docker/thinpool changed.
|
Logical volume docker/thinpool changed.
|
||||||
|
@ -305,7 +305,7 @@ assumes that the Docker daemon is in the `stopped` state.
|
||||||
|
|
||||||
11. Ensure monitoring of the logical volume is enabled.
|
11. Ensure monitoring of the logical volume is enabled.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo lvs -o+seg_monitor
|
$ sudo lvs -o+seg_monitor
|
||||||
|
|
||||||
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Monitor
|
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Monitor
|
||||||
|
@ -317,7 +317,7 @@ assumes that the Docker daemon is in the `stopped` state.
|
||||||
this step, automatic extension of the logical volume will not occur,
|
this step, automatic extension of the logical volume will not occur,
|
||||||
regardless of any settings in the applied profile.
|
regardless of any settings in the applied profile.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo lvchange --monitor y docker/thinpool
|
$ sudo lvchange --monitor y docker/thinpool
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ assumes that the Docker daemon is in the `stopped` state.
|
||||||
exists, move it out of the way so that Docker can use the new LVM pool to
|
exists, move it out of the way so that Docker can use the new LVM pool to
|
||||||
store the contents of image and containers.
|
store the contents of image and containers.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo su -
|
$ sudo su -
|
||||||
# mkdir /var/lib/docker.bk
|
# mkdir /var/lib/docker.bk
|
||||||
# mv /var/lib/docker/* /var/lib/docker.bk
|
# mv /var/lib/docker/* /var/lib/docker.bk
|
||||||
|
@ -358,19 +358,19 @@ assumes that the Docker daemon is in the `stopped` state.
|
||||||
|
|
||||||
**systemd**:
|
**systemd**:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo systemctl start docker
|
$ sudo systemctl start docker
|
||||||
```
|
```
|
||||||
|
|
||||||
**service**:
|
**service**:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo service docker start
|
$ sudo service docker start
|
||||||
```
|
```
|
||||||
|
|
||||||
15. Verify that Docker is using the new configuration using `docker info`.
|
15. Verify that Docker is using the new configuration using `docker info`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker info
|
$ docker info
|
||||||
|
|
||||||
Containers: 0
|
Containers: 0
|
||||||
|
@ -407,7 +407,7 @@ assumes that the Docker daemon is in the `stopped` state.
|
||||||
16. After you have verified that the configuration is correct, you can remove the
|
16. After you have verified that the configuration is correct, you can remove the
|
||||||
`/var/lib/docker.bk` directory which contains the previous configuration.
|
`/var/lib/docker.bk` directory which contains the previous configuration.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo rm -rf /var/lib/docker.bk
|
$ sudo rm -rf /var/lib/docker.bk
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ tool at the OS level, such as Nagios.
|
||||||
|
|
||||||
To view the LVM logs, you can use `journalctl`:
|
To view the LVM logs, you can use `journalctl`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo journalctl -fu dm-event.service
|
$ sudo journalctl -fu dm-event.service
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -464,7 +464,7 @@ If you do not want to use `device_tool`, you can [resize the thin pool manually]
|
||||||
|
|
||||||
2. Use the tool. The following example resizes the thin pool to 200GB.
|
2. Use the tool. The following example resizes the thin pool to 200GB.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ ./device_tool resize 200GB
|
$ ./device_tool resize 200GB
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -480,7 +480,7 @@ it has significant performance and stability drawbacks.
|
||||||
If you are using `loop-lvm` mode, the output of `docker info` shows file
|
If you are using `loop-lvm` mode, the output of `docker info` shows file
|
||||||
paths for `Data loop file` and `Metadata loop file`:
|
paths for `Data loop file` and `Metadata loop file`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker info |grep 'loop file'
|
$ docker info |grep 'loop file'
|
||||||
|
|
||||||
Data loop file: /var/lib/docker/devicemapper/data
|
Data loop file: /var/lib/docker/devicemapper/data
|
||||||
|
@ -492,7 +492,7 @@ thin pool is 100 GB, and is increased to 200 GB.
|
||||||
|
|
||||||
1. List the sizes of the devices.
|
1. List the sizes of the devices.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo ls -lh /var/lib/docker/devicemapper/
|
$ sudo ls -lh /var/lib/docker/devicemapper/
|
||||||
|
|
||||||
total 1175492
|
total 1175492
|
||||||
|
@ -504,13 +504,13 @@ thin pool is 100 GB, and is increased to 200 GB.
|
||||||
which is used to increase **or** decrease the size of a file. Note that
|
which is used to increase **or** decrease the size of a file. Note that
|
||||||
decreasing the size is a destructive operation.
|
decreasing the size is a destructive operation.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo truncate -s 200G /var/lib/docker/devicemapper/data
|
$ sudo truncate -s 200G /var/lib/docker/devicemapper/data
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Verify the file size changed.
|
3. Verify the file size changed.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo ls -lh /var/lib/docker/devicemapper/
|
$ sudo ls -lh /var/lib/docker/devicemapper/
|
||||||
|
|
||||||
total 1.2G
|
total 1.2G
|
||||||
|
@ -522,7 +522,7 @@ thin pool is 100 GB, and is increased to 200 GB.
|
||||||
the loopback device in memory, in GB. Reload it, then list the size again.
|
the loopback device in memory, in GB. Reload it, then list the size again.
|
||||||
After the reload, the size is 200 GB.
|
After the reload, the size is 200 GB.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ echo $[ $(sudo blockdev --getsize64 /dev/loop0) / 1024 / 1024 / 1024 ]
|
$ echo $[ $(sudo blockdev --getsize64 /dev/loop0) / 1024 / 1024 / 1024 ]
|
||||||
|
|
||||||
100
|
100
|
||||||
|
@ -578,7 +578,7 @@ block device and other parameters to suit your situation.
|
||||||
Use the `pvdisplay` command to find the physical block devices currently in
|
Use the `pvdisplay` command to find the physical block devices currently in
|
||||||
use by your thin pool, and the volume group's name.
|
use by your thin pool, and the volume group's name.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo pvdisplay |grep 'VG Name'
|
$ sudo pvdisplay |grep 'VG Name'
|
||||||
|
|
||||||
PV Name /dev/xvdf
|
PV Name /dev/xvdf
|
||||||
|
@ -591,7 +591,7 @@ block device and other parameters to suit your situation.
|
||||||
2. Extend the volume group, using the `vgextend` command with the `VG Name`
|
2. Extend the volume group, using the `vgextend` command with the `VG Name`
|
||||||
from the previous step, and the name of your **new** block device.
|
from the previous step, and the name of your **new** block device.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo vgextend docker /dev/xvdg
|
$ sudo vgextend docker /dev/xvdg
|
||||||
|
|
||||||
Physical volume "/dev/xvdg" successfully created.
|
Physical volume "/dev/xvdg" successfully created.
|
||||||
|
@ -602,7 +602,7 @@ block device and other parameters to suit your situation.
|
||||||
volume right away, without auto-extend. To extend the metadata thinpool
|
volume right away, without auto-extend. To extend the metadata thinpool
|
||||||
instead, use `docker/thinpool_tmeta`.
|
instead, use `docker/thinpool_tmeta`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo lvextend -l+100%FREE -n docker/thinpool
|
$ sudo lvextend -l+100%FREE -n docker/thinpool
|
||||||
|
|
||||||
Size of logical volume docker/thinpool_tdata changed from 95.00 GiB (24319 extents) to 198.00 GiB (50688 extents).
|
Size of logical volume docker/thinpool_tdata changed from 95.00 GiB (24319 extents) to 198.00 GiB (50688 extents).
|
||||||
|
@ -636,8 +636,8 @@ If you reboot the host and find that the `docker` service failed to start,
|
||||||
look for the error, "Non existing device". You need to re-activate the
|
look for the error, "Non existing device". You need to re-activate the
|
||||||
logical volumes with this command:
|
logical volumes with this command:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
sudo lvchange -ay docker/thinpool
|
$ sudo lvchange -ay docker/thinpool
|
||||||
```
|
```
|
||||||
|
|
||||||
## How the `devicemapper` storage driver works
|
## How the `devicemapper` storage driver works
|
||||||
|
@ -648,7 +648,7 @@ sudo lvchange -ay docker/thinpool
|
||||||
Use the `lsblk` command to see the devices and their pools, from the operating
|
Use the `lsblk` command to see the devices and their pools, from the operating
|
||||||
system's point of view:
|
system's point of view:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo lsblk
|
$ sudo lsblk
|
||||||
|
|
||||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||||
|
@ -663,7 +663,7 @@ xvdf 202:80 0 100G 0 disk
|
||||||
|
|
||||||
Use the `mount` command to see the mount-point Docker is using:
|
Use the `mount` command to see the mount-point Docker is using:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ mount |grep devicemapper
|
$ mount |grep devicemapper
|
||||||
/dev/xvda1 on /var/lib/docker/devicemapper type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
|
/dev/xvda1 on /var/lib/docker/devicemapper type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
|
||||||
```
|
```
|
||||||
|
|
|
@ -70,13 +70,13 @@ need to use the legacy `overlay` driver, specify it instead.
|
||||||
|
|
||||||
1. Stop Docker.
|
1. Stop Docker.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo systemctl stop docker
|
$ sudo systemctl stop docker
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Copy the contents of `/var/lib/docker` to a temporary location.
|
2. Copy the contents of `/var/lib/docker` to a temporary location.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ cp -au /var/lib/docker /var/lib/docker.bk
|
$ cp -au /var/lib/docker /var/lib/docker.bk
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ need to use the legacy `overlay` driver, specify it instead.
|
||||||
|
|
||||||
5. Start Docker.
|
5. Start Docker.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo systemctl start docker
|
$ sudo systemctl start docker
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ need to use the legacy `overlay` driver, specify it instead.
|
||||||
Use the `docker info` command and look for `Storage Driver` and
|
Use the `docker info` command and look for `Storage Driver` and
|
||||||
`Backing filesystem`.
|
`Backing filesystem`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker info
|
$ docker info
|
||||||
|
|
||||||
Containers: 0
|
Containers: 0
|
||||||
|
@ -149,7 +149,7 @@ six directories under `/var/lib/docker/overlay2`.
|
||||||
> **Warning**: Do not directly manipulate any files or directories within
|
> **Warning**: Do not directly manipulate any files or directories within
|
||||||
> `/var/lib/docker/`. These files and directories are managed by Docker.
|
> `/var/lib/docker/`. These files and directories are managed by Docker.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ ls -l /var/lib/docker/overlay2
|
$ ls -l /var/lib/docker/overlay2
|
||||||
|
|
||||||
total 24
|
total 24
|
||||||
|
@ -165,7 +165,7 @@ The new `l` (lowercase `L`) directory contains shortened layer identifiers as
|
||||||
symbolic links. These identifiers are used to avoid hitting the page size
|
symbolic links. These identifiers are used to avoid hitting the page size
|
||||||
limitation on arguments to the `mount` command.
|
limitation on arguments to the `mount` command.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ ls -l /var/lib/docker/overlay2/l
|
$ ls -l /var/lib/docker/overlay2/l
|
||||||
|
|
||||||
total 20
|
total 20
|
||||||
|
@ -180,7 +180,7 @@ The lowest layer contains a file called `link`, which contains the name of the
|
||||||
shortened identifier, and a directory called `diff` which contains the
|
shortened identifier, and a directory called `diff` which contains the
|
||||||
layer's contents.
|
layer's contents.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ ls /var/lib/docker/overlay2/3a36935c9df35472229c57f4a27105a136f5e4dbef0f87905b2e506e494e348b/
|
$ ls /var/lib/docker/overlay2/3a36935c9df35472229c57f4a27105a136f5e4dbef0f87905b2e506e494e348b/
|
||||||
|
|
||||||
diff link
|
diff link
|
||||||
|
@ -200,7 +200,7 @@ contents. It also contains a `merged` directory, which contains the unified
|
||||||
contents of its parent layer and itself, and a `work` directory which is used
|
contents of its parent layer and itself, and a `work` directory which is used
|
||||||
internally by OverlayFS.
|
internally by OverlayFS.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ ls /var/lib/docker/overlay2/223c2864175491657d238e2664251df13b63adb8d050924fd1bfcdb278b866f7
|
$ ls /var/lib/docker/overlay2/223c2864175491657d238e2664251df13b63adb8d050924fd1bfcdb278b866f7
|
||||||
|
|
||||||
diff link lower merged work
|
diff link lower merged work
|
||||||
|
@ -217,7 +217,7 @@ etc sbin usr var
|
||||||
To view the mounts which exist when you use the `overlay` storage driver with
|
To view the mounts which exist when you use the `overlay` storage driver with
|
||||||
Docker, use the `mount` command. The output below is truncated for readability.
|
Docker, use the `mount` command. The output below is truncated for readability.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ mount | grep overlay
|
$ mount | grep overlay
|
||||||
|
|
||||||
overlay on /var/lib/docker/overlay2/9186877cdf386d0a3b016149cf30c208f326dca307529e646afce5b3f83f5304/merged
|
overlay on /var/lib/docker/overlay2/9186877cdf386d0a3b016149cf30c208f326dca307529e646afce5b3f83f5304/merged
|
||||||
|
@ -273,7 +273,7 @@ the container is the `upperdir` and is writable.
|
||||||
The following `docker pull` command shows a Docker host downloading a Docker
|
The following `docker pull` command shows a Docker host downloading a Docker
|
||||||
image comprising five layers.
|
image comprising five layers.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker pull ubuntu
|
$ docker pull ubuntu
|
||||||
|
|
||||||
Using default tag: latest
|
Using default tag: latest
|
||||||
|
@ -297,7 +297,7 @@ the directory IDs.
|
||||||
> **Warning**: Do not directly manipulate any files or directories within
|
> **Warning**: Do not directly manipulate any files or directories within
|
||||||
> `/var/lib/docker/`. These files and directories are managed by Docker.
|
> `/var/lib/docker/`. These files and directories are managed by Docker.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ ls -l /var/lib/docker/overlay/
|
$ ls -l /var/lib/docker/overlay/
|
||||||
|
|
||||||
total 20
|
total 20
|
||||||
|
@ -312,7 +312,7 @@ The image layer directories contain the files unique to that layer as well as
|
||||||
hard links to the data that is shared with lower layers. This allows for
|
hard links to the data that is shared with lower layers. This allows for
|
||||||
efficient use of disk space.
|
efficient use of disk space.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ ls -i /var/lib/docker/overlay/38f3ed2eac129654acef11c32670b534670c3a06e483fce313d72e3e0a15baa8/root/bin/ls
|
$ ls -i /var/lib/docker/overlay/38f3ed2eac129654acef11c32670b534670c3a06e483fce313d72e3e0a15baa8/root/bin/ls
|
||||||
|
|
||||||
19793696 /var/lib/docker/overlay/38f3ed2eac129654acef11c32670b534670c3a06e483fce313d72e3e0a15baa8/root/bin/ls
|
19793696 /var/lib/docker/overlay/38f3ed2eac129654acef11c32670b534670c3a06e483fce313d72e3e0a15baa8/root/bin/ls
|
||||||
|
@ -328,7 +328,7 @@ Containers also exist on-disk in the Docker host's filesystem under
|
||||||
`/var/lib/docker/overlay/`. If you list a running container's subdirectory
|
`/var/lib/docker/overlay/`. If you list a running container's subdirectory
|
||||||
using the `ls -l` command, three directories and one file exist:
|
using the `ls -l` command, three directories and one file exist:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ ls -l /var/lib/docker/overlay/<directory-of-running-container>
|
$ ls -l /var/lib/docker/overlay/<directory-of-running-container>
|
||||||
|
|
||||||
total 16
|
total 16
|
||||||
|
@ -341,7 +341,7 @@ drwx------ 3 root root 4096 Jun 20 16:39 work
|
||||||
The `lower-id` file contains the ID of the top layer of the image the container
|
The `lower-id` file contains the ID of the top layer of the image the container
|
||||||
is based on, which is the OverlayFS `lowerdir`.
|
is based on, which is the OverlayFS `lowerdir`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ cat /var/lib/docker/overlay/ec444863a55a9f1ca2df72223d459c5d940a721b2288ff86a3f27be28b53be6c/lower-id
|
$ cat /var/lib/docker/overlay/ec444863a55a9f1ca2df72223d459c5d940a721b2288ff86a3f27be28b53be6c/lower-id
|
||||||
|
|
||||||
55f1e14c361b90570df46371b20ce6d480c434981cbda5fd68c6ff61aa0a5358
|
55f1e14c361b90570df46371b20ce6d480c434981cbda5fd68c6ff61aa0a5358
|
||||||
|
@ -358,7 +358,7 @@ The `work` directory is internal to OverlayFS.
|
||||||
To view the mounts which exist when you use the `overlay` storage driver with
|
To view the mounts which exist when you use the `overlay` storage driver with
|
||||||
Docker, use the `mount` command. The output below is truncated for readability.
|
Docker, use the `mount` command. The output below is truncated for readability.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ mount | grep overlay
|
$ mount | grep overlay
|
||||||
|
|
||||||
overlay on /var/lib/docker/overlay/ec444863a55a.../merged
|
overlay on /var/lib/docker/overlay/ec444863a55a.../merged
|
||||||
|
|
|
@ -17,7 +17,7 @@ mechanism to verify other storage back-ends against, in a testing environment.
|
||||||
|
|
||||||
1. Stop Docker.
|
1. Stop Docker.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo systemctl stop docker
|
$ sudo systemctl stop docker
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -44,14 +44,14 @@ mechanism to verify other storage back-ends against, in a testing environment.
|
||||||
|
|
||||||
3. Start Docker.
|
3. Start Docker.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo systemctl start docker
|
$ sudo systemctl start docker
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Verify that the daemon is using the `vfs` storage driver.
|
4. Verify that the daemon is using the `vfs` storage driver.
|
||||||
Use the `docker info` command and look for `Storage Driver`.
|
Use the `docker info` command and look for `Storage Driver`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker info
|
$ docker info
|
||||||
|
|
||||||
Storage Driver: vfs
|
Storage Driver: vfs
|
||||||
|
@ -79,7 +79,7 @@ it is a deep copy of its parent layer. These layers are all located under
|
||||||
The following `docker pull` command shows a Docker host downloading a Docker
|
The following `docker pull` command shows a Docker host downloading a Docker
|
||||||
image comprising five layers.
|
image comprising five layers.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker pull ubuntu
|
$ docker pull ubuntu
|
||||||
|
|
||||||
Using default tag: latest
|
Using default tag: latest
|
||||||
|
@ -99,7 +99,7 @@ image layer IDs shown in the `docker pull` command. To see the size taken up on
|
||||||
disk by each layer, you can use the `du -sh` command, which gives the size as a
|
disk by each layer, you can use the `du -sh` command, which gives the size as a
|
||||||
human-readable value.
|
human-readable value.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ ls -l /var/lib/docker/vfs/dir/
|
$ ls -l /var/lib/docker/vfs/dir/
|
||||||
|
|
||||||
total 0
|
total 0
|
||||||
|
@ -111,7 +111,7 @@ drwxr-xr-x. 21 root root 224 Aug 2 18:23 a292ac6341a65bf3a5da7b7c251e19de1294bd
|
||||||
drwxr-xr-x. 21 root root 224 Aug 2 18:23 e92be7a4a4e3ccbb7dd87695bca1a0ea373d4f673f455491b1342b33ed91446b
|
drwxr-xr-x. 21 root root 224 Aug 2 18:23 e92be7a4a4e3ccbb7dd87695bca1a0ea373d4f673f455491b1342b33ed91446b
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ du -sh /var/lib/docker/vfs/dir/*
|
$ du -sh /var/lib/docker/vfs/dir/*
|
||||||
|
|
||||||
4.0K /var/lib/docker/vfs/dir/3262dfbe53dac3e1ab7dcc8ad5d8c4d586a11d2ac3c4234892e34bff7f6b821e
|
4.0K /var/lib/docker/vfs/dir/3262dfbe53dac3e1ab7dcc8ad5d8c4d586a11d2ac3c4234892e34bff7f6b821e
|
||||||
|
|
|
@ -56,7 +56,7 @@ use unless you have substantial experience with ZFS on Linux.
|
||||||
2. Copy the contents of `/var/lib/docker/` to `/var/lib/docker.bk` and remove
|
2. Copy the contents of `/var/lib/docker/` to `/var/lib/docker.bk` and remove
|
||||||
the contents of `/var/lib/docker/`.
|
the contents of `/var/lib/docker/`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo cp -au /var/lib/docker /var/lib/docker.bk
|
$ sudo cp -au /var/lib/docker /var/lib/docker.bk
|
||||||
|
|
||||||
$ sudo rm -rf /var/lib/docker/*
|
$ sudo rm -rf /var/lib/docker/*
|
||||||
|
@ -67,7 +67,7 @@ use unless you have substantial experience with ZFS on Linux.
|
||||||
have specified the correct devices, because this is a destructive operation.
|
have specified the correct devices, because this is a destructive operation.
|
||||||
This example adds two devices to the pool.
|
This example adds two devices to the pool.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo zpool create -f zpool-docker -m /var/lib/docker /dev/xvdf /dev/xvdg
|
$ sudo zpool create -f zpool-docker -m /var/lib/docker /dev/xvdf /dev/xvdg
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ use unless you have substantial experience with ZFS on Linux.
|
||||||
display purposes only, and you can use a different name. Check that the pool
|
display purposes only, and you can use a different name. Check that the pool
|
||||||
was created and mounted correctly using `zfs list`.
|
was created and mounted correctly using `zfs list`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo zfs list
|
$ sudo zfs list
|
||||||
|
|
||||||
NAME USED AVAIL REFER MOUNTPOINT
|
NAME USED AVAIL REFER MOUNTPOINT
|
||||||
|
@ -96,7 +96,7 @@ use unless you have substantial experience with ZFS on Linux.
|
||||||
|
|
||||||
4. Start Docker. Use `docker info` to verify that the storage driver is `zfs`.
|
4. Start Docker. Use `docker info` to verify that the storage driver is `zfs`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo docker info
|
$ sudo docker info
|
||||||
Containers: 0
|
Containers: 0
|
||||||
Running: 0
|
Running: 0
|
||||||
|
@ -122,7 +122,7 @@ use unless you have substantial experience with ZFS on Linux.
|
||||||
To increase the size of the `zpool`, you need to add a dedicated block device to
|
To increase the size of the `zpool`, you need to add a dedicated block device to
|
||||||
the Docker host, and then add it to the `zpool` using the `zpool add` command:
|
the Docker host, and then add it to the `zpool` using the `zpool add` command:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo zpool add zpool-docker /dev/xvdh
|
$ sudo zpool add zpool-docker /dev/xvdh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ second uses the `--tmpfs` flag.
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div id="mount-run" class="tab-pane fade in active" markdown="1">
|
<div id="mount-run" class="tab-pane fade in active" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
-it \
|
-it \
|
||||||
--name tmptest \
|
--name tmptest \
|
||||||
|
@ -83,7 +83,7 @@ $ docker run -d \
|
||||||
</div><!--mount-->
|
</div><!--mount-->
|
||||||
<div id="tmpfs-run" class="tab-pane fade" markdown="1">
|
<div id="tmpfs-run" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
-it \
|
-it \
|
||||||
--name tmptest \
|
--name tmptest \
|
||||||
|
@ -105,7 +105,7 @@ tmptest` and looking for the `Mounts` section:
|
||||||
|
|
||||||
Remove the container:
|
Remove the container:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker container stop tmptest
|
$ docker container stop tmptest
|
||||||
|
|
||||||
$ docker container rm tmptest
|
$ docker container rm tmptest
|
||||||
|
@ -125,7 +125,7 @@ as the `--tmpfs` flag does not support them.
|
||||||
The following example sets the `tmpfs-mode` to `1770`, so that it is not
|
The following example sets the `tmpfs-mode` to `1770`, so that it is not
|
||||||
world-readable within the container.
|
world-readable within the container.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
docker run -d \
|
docker run -d \
|
||||||
-it \
|
-it \
|
||||||
--name tmptest \
|
--name tmptest \
|
||||||
|
|
|
@ -18,7 +18,7 @@ documentation for `cadvisor` instructs you to run the `cadvisor` container as
|
||||||
follows:
|
follows:
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo docker run \
|
$ sudo docker run \
|
||||||
--volume=/:/rootfs:ro \
|
--volume=/:/rootfs:ro \
|
||||||
--volume=/var/run:/var/run:rw \
|
--volume=/var/run:/var/run:rw \
|
||||||
|
@ -53,7 +53,7 @@ If you are unsure which process is causing the path mentioned in the error to
|
||||||
be busy and preventing it from being removed, you can use the `lsof` command
|
be busy and preventing it from being removed, you can use the `lsof` command
|
||||||
to find its process. For instance, for the error above:
|
to find its process. For instance, for the error above:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo lsof /var/lib/docker/containers/74bef250361c7817bee19349c93139621b272bc8f654ae112dd4eb9652af9515/shm
|
$ sudo lsof /var/lib/docker/containers/74bef250361c7817bee19349c93139621b272bc8f654ae112dd4eb9652af9515/shm
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -110,13 +110,13 @@ container.
|
||||||
|
|
||||||
**Create a volume**:
|
**Create a volume**:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker volume create my-vol
|
$ docker volume create my-vol
|
||||||
```
|
```
|
||||||
|
|
||||||
**List volumes**:
|
**List volumes**:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker volume ls
|
$ docker volume ls
|
||||||
|
|
||||||
local my-vol
|
local my-vol
|
||||||
|
@ -124,7 +124,7 @@ local my-vol
|
||||||
|
|
||||||
**Inspect a volume**:
|
**Inspect a volume**:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker volume inspect my-vol
|
$ docker volume inspect my-vol
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
@ -140,7 +140,7 @@ $ docker volume inspect my-vol
|
||||||
|
|
||||||
**Remove a volume**:
|
**Remove a volume**:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker volume rm my-vol
|
$ docker volume rm my-vol
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ after running the first one.
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div id="mount-run" class="tab-pane fade in active" markdown="1">
|
<div id="mount-run" class="tab-pane fade in active" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
--name devtest \
|
--name devtest \
|
||||||
--mount source=myvol2,target=/app \
|
--mount source=myvol2,target=/app \
|
||||||
|
@ -171,7 +171,7 @@ $ docker run -d \
|
||||||
</div><!--mount-->
|
</div><!--mount-->
|
||||||
<div id="v-run" class="tab-pane fade" markdown="1">
|
<div id="v-run" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
--name devtest \
|
--name devtest \
|
||||||
-v myvol2:/app \
|
-v myvol2:/app \
|
||||||
|
@ -205,7 +205,7 @@ destination, and that the mount is read-write.
|
||||||
Stop the container and remove the volume. Note volume removal is a separate
|
Stop the container and remove the volume. Note volume removal is a separate
|
||||||
step.
|
step.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker container stop devtest
|
$ docker container stop devtest
|
||||||
|
|
||||||
$ docker container rm devtest
|
$ docker container rm devtest
|
||||||
|
@ -259,7 +259,7 @@ Docker for Azure both support persistent storage using the Cloudstor plugin.
|
||||||
The following example starts a `nginx` service with four replicas, each of which
|
The following example starts a `nginx` service with four replicas, each of which
|
||||||
uses a local volume called `myvol2`.
|
uses a local volume called `myvol2`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create -d \
|
$ docker service create -d \
|
||||||
--replicas=4 \
|
--replicas=4 \
|
||||||
--name devtest-service \
|
--name devtest-service \
|
||||||
|
@ -269,7 +269,7 @@ $ docker service create -d \
|
||||||
|
|
||||||
Use `docker service ps devtest-service` to verify that the service is running:
|
Use `docker service ps devtest-service` to verify that the service is running:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ps devtest-service
|
$ docker service ps devtest-service
|
||||||
|
|
||||||
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
||||||
|
@ -278,7 +278,7 @@ ID NAME IMAGE NODE
|
||||||
|
|
||||||
Remove the service, which stops all its tasks:
|
Remove the service, which stops all its tasks:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service rm devtest-service
|
$ docker service rm devtest-service
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ The `--mount` and `-v` examples have the same end result.
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div id="mount-empty-run" class="tab-pane fade in active" markdown="1">
|
<div id="mount-empty-run" class="tab-pane fade in active" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
--name=nginxtest \
|
--name=nginxtest \
|
||||||
--mount source=nginx-vol,destination=/usr/share/nginx/html \
|
--mount source=nginx-vol,destination=/usr/share/nginx/html \
|
||||||
|
@ -323,7 +323,7 @@ $ docker run -d \
|
||||||
</div><!--mount-->
|
</div><!--mount-->
|
||||||
<div id="v-empty-run" class="tab-pane fade" markdown="1">
|
<div id="v-empty-run" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
--name=nginxtest \
|
--name=nginxtest \
|
||||||
-v nginx-vol:/usr/share/nginx/html \
|
-v nginx-vol:/usr/share/nginx/html \
|
||||||
|
@ -337,7 +337,7 @@ After running either of these examples, run the following commands to clean up
|
||||||
the containers and volumes. Note volume removal is a separate step.
|
the containers and volumes. Note volume removal is a separate step.
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker container stop nginxtest
|
$ docker container stop nginxtest
|
||||||
|
|
||||||
$ docker container rm nginxtest
|
$ docker container rm nginxtest
|
||||||
|
@ -367,7 +367,7 @@ The `--mount` and `-v` examples have the same result.
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div id="mount-readonly" class="tab-pane fade in active" markdown="1">
|
<div id="mount-readonly" class="tab-pane fade in active" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
--name=nginxtest \
|
--name=nginxtest \
|
||||||
--mount source=nginx-vol,destination=/usr/share/nginx/html,readonly \
|
--mount source=nginx-vol,destination=/usr/share/nginx/html,readonly \
|
||||||
|
@ -377,7 +377,7 @@ $ docker run -d \
|
||||||
</div><!--mount-->
|
</div><!--mount-->
|
||||||
<div id="v-readonly" class="tab-pane fade" markdown="1">
|
<div id="v-readonly" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
--name=nginxtest \
|
--name=nginxtest \
|
||||||
-v nginx-vol:/usr/share/nginx/html:ro \
|
-v nginx-vol:/usr/share/nginx/html:ro \
|
||||||
|
@ -408,7 +408,7 @@ correctly. Look for the `Mounts` section:
|
||||||
Stop and remove the container, and remove the volume. Volume removal is a
|
Stop and remove the container, and remove the volume. Volume removal is a
|
||||||
separate step.
|
separate step.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker container stop nginxtest
|
$ docker container stop nginxtest
|
||||||
|
|
||||||
$ docker container rm nginxtest
|
$ docker container rm nginxtest
|
||||||
|
@ -448,7 +448,7 @@ host and can connect to the second using SSH.
|
||||||
|
|
||||||
On the Docker host, install the `vieux/sshfs` plugin:
|
On the Docker host, install the `vieux/sshfs` plugin:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin install --grant-all-permissions vieux/sshfs
|
$ docker plugin install --grant-all-permissions vieux/sshfs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ This example specifies a SSH password, but if the two hosts have shared keys
|
||||||
configured, you can omit the password. Each volume driver may have zero or more
|
configured, you can omit the password. Each volume driver may have zero or more
|
||||||
configurable options, each of which is specified using an `-o` flag.
|
configurable options, each of which is specified using an `-o` flag.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker volume create --driver vieux/sshfs \
|
$ docker volume create --driver vieux/sshfs \
|
||||||
-o sshcmd=test@node2:/home/test \
|
-o sshcmd=test@node2:/home/test \
|
||||||
-o password=testpassword \
|
-o password=testpassword \
|
||||||
|
@ -472,7 +472,7 @@ configured, you can omit the password. Each volume driver may have zero or more
|
||||||
configurable options. **If the volume driver requires you to pass options, you
|
configurable options. **If the volume driver requires you to pass options, you
|
||||||
must use the `--mount` flag to mount the volume, rather than `-v`.**
|
must use the `--mount` flag to mount the volume, rather than `-v`.**
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d \
|
$ docker run -d \
|
||||||
--name sshfs-container \
|
--name sshfs-container \
|
||||||
--volume-driver vieux/sshfs \
|
--volume-driver vieux/sshfs \
|
||||||
|
@ -485,7 +485,7 @@ $ docker run -d \
|
||||||
This example shows how you can create an NFS volume when creating a service. This example uses `10.0.0.10` as the NFS server and `/var/docker-nfs` as the exported directory on the NFS server. Note that the volume driver specified is `local`.
|
This example shows how you can create an NFS volume when creating a service. This example uses `10.0.0.10` as the NFS server and `/var/docker-nfs` as the exported directory on the NFS server. Note that the volume driver specified is `local`.
|
||||||
|
|
||||||
#### NFSv3
|
#### NFSv3
|
||||||
```bash
|
```console
|
||||||
$ docker service create -d \
|
$ docker service create -d \
|
||||||
--name nfs-service \
|
--name nfs-service \
|
||||||
--mount 'type=volume,source=nfsvolume,target=/app,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/var/docker-nfs,volume-opt=o=addr=10.0.0.10' \
|
--mount 'type=volume,source=nfsvolume,target=/app,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/var/docker-nfs,volume-opt=o=addr=10.0.0.10' \
|
||||||
|
@ -493,7 +493,7 @@ $ docker service create -d \
|
||||||
```
|
```
|
||||||
|
|
||||||
#### NFSv4
|
#### NFSv4
|
||||||
```bash
|
```console
|
||||||
docker service create -d \
|
docker service create -d \
|
||||||
--name nfs-service \
|
--name nfs-service \
|
||||||
--mount 'type=volume,source=nfsvolume,target=/app,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/var/docker-nfs,"volume-opt=o=addr=10.0.0.10,rw,nfsvers=4,async"' \
|
--mount 'type=volume,source=nfsvolume,target=/app,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/var/docker-nfs,"volume-opt=o=addr=10.0.0.10,rw,nfsvers=4,async"' \
|
||||||
|
@ -503,8 +503,8 @@ docker service create -d \
|
||||||
### Create CIFS/Samba volumes
|
### Create CIFS/Samba volumes
|
||||||
|
|
||||||
You can mount a Samba share directly in docker without configuring a mount point on your host.
|
You can mount a Samba share directly in docker without configuring a mount point on your host.
|
||||||
```bash
|
```console
|
||||||
docker volume create \
|
$ docker volume create \
|
||||||
--driver local \
|
--driver local \
|
||||||
--opt type=cifs \
|
--opt type=cifs \
|
||||||
--opt device=//uxxxxx.your-server.de/backup \
|
--opt device=//uxxxxx.your-server.de/backup \
|
||||||
|
|
Loading…
Reference in New Issue