mirror of https://github.com/docker/docs.git
Update Volumes, fix navigation
Signed-off-by: Usha Mandya <usha.mandya@docker.com>
This commit is contained in:
parent
8773df7f16
commit
d3314f86b1
|
@ -6,7 +6,7 @@ long: |-
|
|||
the container, `docker export` will export the contents of the *underlying*
|
||||
directory, not the contents of the volume.
|
||||
|
||||
Refer to [Backup, restore, or migrate data volumes](https://docs.docker.com/storage/volumes/#backup-restore-or-migrate-data-volumes)
|
||||
Refer to [Back up, restore, or migrate data volumes](https://docs.docker.com/storage/volumes/#back-up-restore-or-migrate-data-volumes)
|
||||
in the user guide for examples on exporting data in a volume.
|
||||
usage: docker export [OPTIONS] CONTAINER
|
||||
pname: docker
|
||||
|
|
|
@ -179,6 +179,28 @@ guides:
|
|||
title: Configure and run Docker
|
||||
- path: /config/daemon/systemd/
|
||||
title: Control Docker with systemd
|
||||
- path: /config/daemon/ipv6/
|
||||
title: Configure the daemon for IPv6
|
||||
- path: /network/iptables/
|
||||
title: Docker and iptables
|
||||
- sectiontitle: Store data within containers
|
||||
section:
|
||||
- path: /storage/storagedriver/
|
||||
title: About storage drivers
|
||||
- path: /storage/storagedriver/select-storage-driver/
|
||||
title: Select a storage driver
|
||||
- path: /storage/storagedriver/aufs-driver/
|
||||
title: Use the AUFS storage driver
|
||||
- path: /storage/storagedriver/btrfs-driver/
|
||||
title: Use the Btrfs storage driver
|
||||
- path: /storage/storagedriver/device-mapper-driver/
|
||||
title: Use the Device mapper storage driver
|
||||
- path: /storage/storagedriver/overlayfs-driver/
|
||||
title: Use the OverlayFS storage driver
|
||||
- path: /storage/storagedriver/zfs-driver/
|
||||
title: Use the ZFS storage driver
|
||||
- path: /storage/storagedriver/vfs-driver/
|
||||
title: Use the VFS storage driver
|
||||
- path: /config/daemon/prometheus/
|
||||
title: Collect metrics with Prometheus
|
||||
- sectiontitle: Configure containers
|
||||
|
@ -307,6 +329,10 @@ guides:
|
|||
section:
|
||||
- path: /network/
|
||||
title: Networking overview
|
||||
- path: /config/containers/container-networking/
|
||||
title: Container networking
|
||||
- path: /network/proxy/
|
||||
title: Configure Docker to use a proxy server
|
||||
- path: /network/bridge/
|
||||
title: Use bridge networks
|
||||
- path: /network/overlay/
|
||||
|
@ -329,24 +355,14 @@ guides:
|
|||
title: Overlay networking tutorial
|
||||
- path: /network/network-tutorial-macvlan/
|
||||
title: Macvlan network tutorial
|
||||
- sectiontitle: Configure the daemon and containers
|
||||
section:
|
||||
- path: /config/daemon/ipv6/
|
||||
title: Configure the daemon for IPv6
|
||||
- path: /network/iptables/
|
||||
title: Docker and iptables
|
||||
- path: /config/containers/container-networking/
|
||||
title: Container networking
|
||||
- path: /network/proxy/
|
||||
title: Configure Docker to use a proxy server
|
||||
- sectiontitle: Legacy networking content
|
||||
section:
|
||||
- path: /network/links/
|
||||
title: (Legacy) Container links
|
||||
- sectiontitle: Manage application data
|
||||
- sectiontitle: Configure storage
|
||||
section:
|
||||
- path: /storage/
|
||||
title: Storage overview
|
||||
title: Overview
|
||||
- path: /storage/volumes/
|
||||
title: Volumes
|
||||
- path: /storage/bind-mounts/
|
||||
|
@ -354,25 +370,7 @@ guides:
|
|||
- path: /storage/tmpfs/
|
||||
title: tmpfs mounts
|
||||
- path: /storage/troubleshooting_volume_errors/
|
||||
title: Troubleshoot volume problems
|
||||
- sectiontitle: Store data within containers
|
||||
section:
|
||||
- path: /storage/storagedriver/
|
||||
title: About storage drivers
|
||||
- path: /storage/storagedriver/select-storage-driver/
|
||||
title: Select a storage driver
|
||||
- path: /storage/storagedriver/aufs-driver/
|
||||
title: Use the AUFS storage driver
|
||||
- path: /storage/storagedriver/btrfs-driver/
|
||||
title: Use the Btrfs storage driver
|
||||
- path: /storage/storagedriver/device-mapper-driver/
|
||||
title: Use the Device mapper storage driver
|
||||
- path: /storage/storagedriver/overlayfs-driver/
|
||||
title: Use the OverlayFS storage driver
|
||||
- path: /storage/storagedriver/zfs-driver/
|
||||
title: Use the ZFS storage driver
|
||||
- path: /storage/storagedriver/vfs-driver/
|
||||
title: Use the VFS storage driver
|
||||
title: Troubleshoot
|
||||
- path: /get-started/resources/
|
||||
title: "Educational resources"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ computer, for example.
|
|||
Also note that filesystem changes in volume that are attached to the
|
||||
container are not included in the image, and must be backed up separately.
|
||||
|
||||
If you used a [named volume](../storage/index.md#more-details-about-mount-types) to store container data, such as databases, refer to the [backup, restore, or migrate data volumes](../storage/volumes.md#backup-restore-or-migrate-data-volumes) page in the storage section.
|
||||
If you used a [named volume](../storage/index.md#more-details-about-mount-types) to store container data, such as databases, refer to the [back up, restore, or migrate data volumes](../storage/volumes.md#back-up-restore-or-migrate-data-volumes) page in the storage section.
|
||||
|
||||
2. Use [`docker push`](../engine/reference/commandline/push.md) to push any
|
||||
images you have built locally and want to keep to the [Docker Hub registry](../docker-hub/index.md).
|
||||
|
@ -47,4 +47,4 @@ and [install a different version](release-notes.md) or reset Docker Desktop to f
|
|||
2. Re-create your containers if needed, using [`docker run`](../engine/reference/commandline/load.md),
|
||||
or [Docker Compose](../compose/index.md).
|
||||
|
||||
Refer to the [backup, restore, or migrate data volumes](../storage/volumes.md#backup-restore-or-migrate-data-volumes) page in the storage section to restore volume data.
|
||||
Refer to the [backup, restore, or migrate data volumes](../storage/volumes.md#back-up-restore-or-migrate-data-volumes) page in the storage section to restore volume data.
|
||||
|
|
|
@ -47,7 +47,7 @@ This page contains release notes for older versions of Docker Desktop for Mac.
|
|||
- Re-enable raw as the default disk format for users running macOS 10.13.4 and higher. Note this change only takes effect after a "reset to factory defaults" or "remove all data" (from the Whale menu -> Preferences -> Reset). Related to [docker/for-mac#2625](https://github.com/docker/for-mac/issues/2625)
|
||||
|
||||
* Bug fixes and minor changes
|
||||
- AUFS storage driver is deprecated in Docker Desktop and AUFS support will be removed in the next major release. You can continue with AUFS in Docker Desktop 18.06.x, but you will need to reset disk image (in Preferences > Reset menu) before updating to the next major update. You can check documentation to [save images](/engine/reference/commandline/save/#examples) and [backup volumes](../../storage/volumes.md#backup-restore-or-migrate-data-volumes)
|
||||
- AUFS storage driver is deprecated in Docker Desktop and AUFS support will be removed in the next major release. You can continue with AUFS in Docker Desktop 18.06.x, but you will need to reset disk image (in Preferences > Reset menu) before updating to the next major update. You can check documentation to [save images](/engine/reference/commandline/save/#examples) and [back up volumes](../../storage/volumes.md#back-up-restore-or-migrate-data-volumes)
|
||||
- OS X El Captain 10.11 is deprecated in Docker Desktop. You will not be able to install updates after Docker Desktop 18.06.x. We recommend upgrading to the latest version of macOS.
|
||||
- Fix bug which would cause VM logs to be written to RAM rather than disk in some cases, and the VM to hang. See [docker/for-mac#2984](https://github.com/docker/for-mac/issues/2984)
|
||||
- Fix network connection leak triggered by haproxy TCP health-checks [docker/for-mac#1132](https://github.com/docker/for-mac/issues/1132)
|
||||
|
|
|
@ -67,7 +67,7 @@ This page contains release notes for older versions of Docker Desktop for Window
|
|||
- Kubernetes Support. You can now run a single-node Kubernetes cluster from the "Kubernetes" Pane in Docker for Windows settings and use kubectl commands as well as Docker commands. See [the Kubernetes section](../kubernetes.md)
|
||||
|
||||
* Bug fixes and minor changes
|
||||
- AUFS storage driver is deprecated in Docker Desktop and AUFS support will be removed in the next major release. You can continue with AUFS in Docker Desktop 18.06.x, but you will need to reset the disk image (in Settings > Reset menu) before updating to the next major update. You can check documentation to [save images](/engine/reference/commandline/save/#examples) and [backup volumes](../../storage/volumes.md#backup-restore-or-migrate-data-volumes)
|
||||
- AUFS storage driver is deprecated in Docker Desktop and AUFS support will be removed in the next major release. You can continue with AUFS in Docker Desktop 18.06.x, but you will need to reset the disk image (in Settings > Reset menu) before updating to the next major update. You can check documentation to [save images](/engine/reference/commandline/save/#examples) and [backup volumes](../../storage/volumes.md#back-up-restore-or-migrate-data-volumes)
|
||||
- Fix bug which would in some cases cause virtual machine logs to be written to RAM rather than disk, and the virtual machine to hang.
|
||||
- Fix security issue with named pipe connection to docker service.
|
||||
- Fix VPNKit memory leak. Fixes [docker/for-win#2087](https://github.com/docker/for-win/issues/2087), [moby/vpnkit#371](https://github.com/moby/vpnkit/issues/371)
|
||||
|
|
|
@ -950,7 +950,7 @@ This release contains a Kubernetes upgrade. Note that your local Kubernetes clus
|
|||
- Add an experimental SOCKS server to allow access to container networks, see [docker/for-mac#2670](https://github.com/docker/for-mac/issues/2670#issuecomment-372365274). Also see [docker/for-mac#2721](https://github.com/docker/for-mac/issues/2721)
|
||||
|
||||
* Bug fixes and minor changes
|
||||
- AUFS storage driver is deprecated in Docker Desktop and AUFS support will be removed in the next major release. You can continue with AUFS in Docker Desktop 18.06.x, but you will need to reset disk image (in Preferences > Reset menu) before updating to the next major update. You can check documentation to [save images](/engine/reference/commandline/save/#examples) and [backup volumes](../../storage/volumes.md#backup-restore-or-migrate-data-volumes)
|
||||
- AUFS storage driver is deprecated in Docker Desktop and AUFS support will be removed in the next major release. You can continue with AUFS in Docker Desktop 18.06.x, but you will need to reset disk image (in Preferences > Reset menu) before updating to the next major update. You can check documentation to [save images](/engine/reference/commandline/save/#examples) and [back up volumes](../../storage/volumes.md#back-up-restore-or-migrate-data-volumes)
|
||||
- Fix startup issue with AUFS [docker/for-mac#2804](https://github.com/docker/for-mac/issues/2804)
|
||||
- Fix status bug which could prevent the Kubernetes cluster from starting. Fixes [docker/for-mac#2990](https://github.com/docker/for-mac/issues/2990)
|
||||
- Fix bug which would cause virtual machine logs to be written to RAM rather than disk in some cases, and the virtual machine to hang. See [docker/for-mac#2984](https://github.com/docker/for-mac/issues/2984)
|
||||
|
|
|
@ -1162,7 +1162,7 @@ This release contains a Kubernetes upgrade. Note that your local Kubernetes clus
|
|||
- New Kubernetes menu item allowing to switch Kubernetes context & connect to clusters other than the local one.
|
||||
|
||||
* Bug fixes and minor changes
|
||||
- AUFS storage driver is deprecated in Docker Desktop and AUFS support will be removed in the next major release. You can continue with AUFS in Docker Desktop 18.06.x, but you will need to reset disk image (in Settings > Reset menu) before updating to the next major update. You can check documentation to [save images](/engine/reference/commandline/save/#examples) and [backup volumes](../../storage/volumes.md#backup-restore-or-migrate-data-volumes)
|
||||
- AUFS storage driver is deprecated in Docker Desktop and AUFS support will be removed in the next major release. You can continue with AUFS in Docker Desktop 18.06.x, but you will need to reset disk image (in Settings > Reset menu) before updating to the next major update. You can check documentation to [save images](/engine/reference/commandline/save/#examples) and [back up volumes](../../storage/volumes.md#back-up-restore-or-migrate-data-volumes)
|
||||
- Fix startup issue with AUFS
|
||||
- Fix status bug which could prevent the kubernetes cluster from starting.
|
||||
- Fix bug which would cause VM logs to be written to RAM rather than disk in some cases, and the VM to hang.
|
||||
|
|
|
@ -146,7 +146,7 @@ $ docker volume rm my-vol
|
|||
|
||||
## Start a container with a volume
|
||||
|
||||
If you start a container with a volume that does not yet exist, Docker creates
|
||||
If you start a container with a volume that doesn't yet exist, Docker creates
|
||||
the volume for you. The following example mounts the volume `myvol2` into
|
||||
`/app/` in the container.
|
||||
|
||||
|
@ -213,12 +213,11 @@ $ docker container rm devtest
|
|||
$ docker volume rm myvol2
|
||||
```
|
||||
|
||||
## Use a volume with docker-compose
|
||||
## Use a volume with Docker Compose
|
||||
|
||||
A single docker compose service with a volume looks like this:
|
||||
Here's an example of a single Docker Compose service with a volume:
|
||||
|
||||
```yaml
|
||||
version: "{{ site.compose_file_v3 }}"
|
||||
services:
|
||||
frontend:
|
||||
image: node:lts
|
||||
|
@ -228,14 +227,12 @@ volumes:
|
|||
myapp:
|
||||
```
|
||||
|
||||
On the first invocation of `docker-compose up` the volume will be created. The same
|
||||
volume will be reused on following invocations.
|
||||
Running `docker compose up` for the first time creates a volume. The same volume is reused when you subsequently run the command.
|
||||
|
||||
A volume may be created directly outside of compose with `docker volume create` and
|
||||
then referenced inside `docker-compose.yml` as follows:
|
||||
You can create a volume directly outside of Compose using `docker volume create` and
|
||||
then reference it inside `docker-compose.yml` as follows:
|
||||
|
||||
```yaml
|
||||
version: "{{ site.compose_file_v3 }}"
|
||||
services:
|
||||
frontend:
|
||||
image: node:lts
|
||||
|
@ -246,17 +243,15 @@ volumes:
|
|||
external: true
|
||||
```
|
||||
|
||||
For more information about using volumes with compose see
|
||||
[the compose reference](../compose/compose-file/compose-file-v3.md#volume-configuration-reference).
|
||||
For more information about using volumes with Compose, refer to the [Volumes](../compose/compose-file/index.md#volumes) section in the Compose specification.
|
||||
|
||||
### Start a service with volumes
|
||||
|
||||
When you start a service and define a volume, each service container uses its own
|
||||
local volume. None of the containers can share this data if you use the `local`
|
||||
volume driver, but some volume drivers do support shared storage. Docker for AWS and
|
||||
Docker for Azure both support persistent storage using the Cloudstor plugin.
|
||||
volume driver. However, some volume drivers do support shared storage.
|
||||
|
||||
The following example starts a `nginx` service with four replicas, each of which
|
||||
The following example starts an `nginx` service with four replicas, each of which
|
||||
uses a local volume called `myvol2`.
|
||||
|
||||
```console
|
||||
|
@ -276,32 +271,32 @@ ID NAME IMAGE NODE
|
|||
4d7oz1j85wwn devtest-service.1 nginx:latest moby Running Running 14 seconds ago
|
||||
```
|
||||
|
||||
Remove the service, which stops all its tasks:
|
||||
You can remove the service to stop the running tasks:
|
||||
|
||||
```console
|
||||
$ docker service rm devtest-service
|
||||
```
|
||||
|
||||
Removing the service does not remove any volumes created by the service.
|
||||
Removing the service doesn't remove any volumes created by the service.
|
||||
Volume removal is a separate step.
|
||||
|
||||
#### Syntax differences for services
|
||||
|
||||
The `docker service create` command does not support the `-v` or `--volume` flag.
|
||||
The `docker service create` command doesn't support the `-v` or `--volume` flag.
|
||||
When mounting a volume into a service's containers, you must use the `--mount`
|
||||
flag.
|
||||
|
||||
### Populate a volume using a container
|
||||
|
||||
If you start a container which creates a new volume, as above, and the container
|
||||
has files or directories in the directory to be mounted (such as `/app/` above),
|
||||
If you start a container which creates a new volume, and the container
|
||||
has files or directories in the directory to be mounted such as `/app/`,
|
||||
the directory's contents are copied into the volume. The container then
|
||||
mounts and uses the volume, and other containers which use the volume also
|
||||
have access to the pre-populated content.
|
||||
|
||||
To illustrate this, this example starts an `nginx` container and populates the
|
||||
new volume `nginx-vol` with the contents of the container's
|
||||
`/usr/share/nginx/html` directory, which is where Nginx stores its default HTML
|
||||
To illustrate this, the following example starts an `nginx` container and
|
||||
populates the new volume `nginx-vol` with the contents of the container's
|
||||
`/usr/share/nginx/html` directory. This is where Nginx stores its default HTML
|
||||
content.
|
||||
|
||||
The `--mount` and `-v` examples have the same end result.
|
||||
|
@ -334,7 +329,7 @@ $ docker run -d \
|
|||
</div><!--tab-content-->
|
||||
|
||||
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.
|
||||
|
||||
|
||||
```console
|
||||
|
@ -349,14 +344,14 @@ $ docker volume rm nginx-vol
|
|||
|
||||
For some development applications, the container needs to write into the bind
|
||||
mount so that changes are propagated back to the Docker host. At other times,
|
||||
the container only needs read access to the data. Remember that multiple
|
||||
containers can mount the same volume, and it can be mounted read-write for some
|
||||
of them and read-only for others, at the same time.
|
||||
the container only needs read access to the data. Multiple
|
||||
containers can mount the same volume. You can simultaneously mount a
|
||||
single volume as `read-write` for some containers and as `read-only` for others.
|
||||
|
||||
This example modifies the one above but mounts the directory as a read-only
|
||||
The following example modifies the one above but mounts the directory as a read-only
|
||||
volume, by adding `ro` to the (empty by default) list of options, after the
|
||||
mount point within the container. Where multiple options are present, separate
|
||||
them by commas.
|
||||
mount point within the container. Where multiple options are present, you can separate
|
||||
them using commas.
|
||||
|
||||
The `--mount` and `-v` examples have the same result.
|
||||
|
||||
|
@ -387,7 +382,7 @@ $ docker run -d \
|
|||
</div><!--volume-->
|
||||
</div><!--tab-content-->
|
||||
|
||||
Use `docker inspect nginxtest` to verify that the readonly mount was created
|
||||
Use `docker inspect nginxtest` to verify that the read-only mount was created
|
||||
correctly. Look for the `Mounts` section:
|
||||
|
||||
```json
|
||||
|
@ -416,9 +411,9 @@ $ docker container rm nginxtest
|
|||
$ docker volume rm nginx-vol
|
||||
```
|
||||
|
||||
## Share data among machines
|
||||
## Share data between machines
|
||||
|
||||
When building fault-tolerant applications, you might need to configure multiple
|
||||
When building fault-tolerant applications, you may need to configure multiple
|
||||
replicas of the same service to have access to the same files.
|
||||
|
||||

|
||||
|
@ -441,10 +436,10 @@ The following examples use the `vieux/sshfs` volume driver, first when creating
|
|||
a standalone volume, and then when starting a container which creates a new
|
||||
volume.
|
||||
|
||||
### Initial set-up
|
||||
### Initial setup
|
||||
|
||||
This example assumes that you have two nodes, the first of which is a Docker
|
||||
host and can connect to the second using SSH.
|
||||
The following example assumes that you have two nodes, the first of which is a Docker
|
||||
host and can connect to the second node using SSH.
|
||||
|
||||
On the Docker host, install the `vieux/sshfs` plugin:
|
||||
|
||||
|
@ -454,8 +449,8 @@ $ docker plugin install --grant-all-permissions vieux/sshfs
|
|||
|
||||
### Create a volume using a volume driver
|
||||
|
||||
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
|
||||
This example specifies an SSH password, but if the two hosts have shared keys
|
||||
configured, you can exclude the password. Each volume driver may have zero or more
|
||||
configurable options, each of which is specified using an `-o` flag.
|
||||
|
||||
```console
|
||||
|
@ -467,10 +462,13 @@ $ docker volume create --driver vieux/sshfs \
|
|||
|
||||
### Start a container which creates a volume using a volume driver
|
||||
|
||||
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
|
||||
configurable options. **If the volume driver requires you to pass options, you
|
||||
must use the `--mount` flag to mount the volume, rather than `-v`.**
|
||||
The following example specifies an SSH password. However, if the two hosts have
|
||||
shared keys configured, you can exclude the password. Each volume driver may have zero or more configurable options.
|
||||
|
||||
> **Note:**
|
||||
>
|
||||
> If the volume driver requires you to pass any options, you must use the `--mount` flag to mount the volume, and not `-v`.
|
||||
|
||||
|
||||
```console
|
||||
$ docker run -d \
|
||||
|
@ -482,9 +480,10 @@ $ docker run -d \
|
|||
|
||||
### Create a service which creates an NFS volume
|
||||
|
||||
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`.
|
||||
The following example shows how you can create an NFS volume when creating a service. It 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
|
||||
|
||||
```console
|
||||
$ docker service create -d \
|
||||
--name nfs-service \
|
||||
|
@ -493,6 +492,7 @@ $ docker service create -d \
|
|||
```
|
||||
|
||||
#### NFSv4
|
||||
|
||||
```console
|
||||
$ docker service create -d \
|
||||
--name nfs-service \
|
||||
|
@ -514,7 +514,7 @@ $ docker volume create \
|
|||
|
||||
Notice the `addr` option is required if using a hostname instead of an IP so docker can perform the hostname lookup.
|
||||
|
||||
## Backup, restore, or migrate data volumes
|
||||
## Back up, restore, or migrate data volumes
|
||||
|
||||
Volumes are useful for backups, restores, and migrations. Use the
|
||||
`--volumes-from` flag to create a new container that mounts that volume.
|
||||
|
@ -527,7 +527,7 @@ For example, create a new container named `dbstore`:
|
|||
$ docker run -v /dbdata --name dbstore ubuntu /bin/bash
|
||||
```
|
||||
|
||||
Then in the next command, we:
|
||||
In the next command:
|
||||
|
||||
- Launch a new container and mount the volume from the `dbstore` container
|
||||
- Mount a local host directory as `/backup`
|
||||
|
@ -537,13 +537,13 @@ Then in the next command, we:
|
|||
$ docker run --rm --volumes-from dbstore -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /dbdata
|
||||
```
|
||||
|
||||
When the command completes and the container stops, we are left with a backup of
|
||||
our `dbdata` volume.
|
||||
When the command completes and the container stops, it creates a backup of
|
||||
the `dbdata` volume.
|
||||
|
||||
### Restore volume from backup
|
||||
### Restore volume from a backup
|
||||
|
||||
With the backup just created, you can restore it to the same container, or
|
||||
another that you made elsewhere.
|
||||
With the backup just created, you can restore it to the same container, or to
|
||||
another container that you created elsewhere.
|
||||
|
||||
For example, create a new container named `dbstore2`:
|
||||
|
||||
|
@ -551,27 +551,27 @@ For example, create a new container named `dbstore2`:
|
|||
$ docker run -v /dbdata --name dbstore2 ubuntu /bin/bash
|
||||
```
|
||||
|
||||
Then un-tar the backup file in the new container’s data volume:
|
||||
Then, un-tar the backup file in the new container’s data volume:
|
||||
|
||||
```console
|
||||
$ docker run --rm --volumes-from dbstore2 -v $(pwd):/backup ubuntu bash -c "cd /dbdata && tar xvf /backup/backup.tar --strip 1"
|
||||
```
|
||||
|
||||
You can use the techniques above to automate backup, migration and restore
|
||||
You can use the techniques above to automate backup, migration, and restore
|
||||
testing using your preferred tools.
|
||||
|
||||
## Remove volumes
|
||||
|
||||
A Docker data volume persists after a container is deleted. There are two types
|
||||
A Docker data volume persists after you delete a container. There are two types
|
||||
of volumes to consider:
|
||||
|
||||
- **Named volumes** have a specific source from outside the container, for example `awesome:/bar`.
|
||||
- **Anonymous volumes** have no specific source so when the container is deleted, instruct the Docker Engine daemon to remove them.
|
||||
- Named volumes have a specific source from outside the container, for example, `awesome:/bar`.
|
||||
- Anonymous volumes have no specific source, therefore, when the container is deleted, you can instruct the Docker Engine daemon to remove them.
|
||||
|
||||
### Remove anonymous volumes
|
||||
|
||||
To automatically remove anonymous volumes, use the `--rm` option. For example,
|
||||
this command creates an anonymous `/foo` volume. When the container is removed,
|
||||
this command creates an anonymous `/foo` volume. When you remove the container,
|
||||
the Docker Engine removes the `/foo` volume but not the `awesome` volume.
|
||||
|
||||
```console
|
||||
|
@ -581,9 +581,9 @@ $ docker run --rm -v /foo -v awesome:/bar busybox top
|
|||
> **Note**:
|
||||
>
|
||||
> If another container binds the volumes with
|
||||
> `--volumes-from`, the volume definitions are _copied_ and the
|
||||
> `--volumes-from`, the volume definitions are _copied_ and the
|
||||
> anonymous volume also stays after the first container is removed.
|
||||
|
||||
|
||||
### Remove all volumes
|
||||
|
||||
To remove all unused volumes and free up space:
|
||||
|
@ -592,22 +592,6 @@ To remove all unused volumes and free up space:
|
|||
$ docker volume prune
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Next steps
|
||||
|
||||
- Learn about [bind mounts](bind-mounts.md).
|
||||
|
|
Loading…
Reference in New Issue