mirror of https://github.com/docker/docs.git
Rewrite "save and restore data" section
This started as a "fix some links", but reading the section, I found various issues that could use some improvement. After that, I noticed that both the Windows and Mac pages had the same content, so I moved this to a common page instead. Note that there's still additional information that should likely be included (and perhaps a rewrite into "per topic" headings (containers, images, ...). Things that are missing; - backup/restore swarmkit configs - backup/restore swarmkit secrets - backup/restore CLI configuration, trust data etc. What I did in this pull request: - recommend pushing images to Docker Hub as the default approach to back up images (but kept `docker image save` as an alternative) - recommend `docker container commit` to save containers to an image, as doing so preserves both the container's configuration _and_ filesystem changes. `docker container export` only preserves the filesystem, but all other configuration is lost, which makes it hard to restore a container from it. Using `docker container commit` (committing the container to an image) also allows to follow the same procedure to backup containers as for images (both allowing them to be pushed to a registry, or to a file). - added some information about "wether or not" containers should be backed up, as it may not be needed to back up containers if all data is stored in volumes (best practice). - added some warnings regarding "sensitive data" (environment variables), and links to making repositories private before pushing. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
fd6a291c0b
commit
203a4ee74b
|
@ -1262,6 +1262,8 @@ manuals:
|
|||
title: Dashboard
|
||||
- path: /desktop/faqs/
|
||||
title: FAQs
|
||||
- path: /desktop/backup-and-restore/
|
||||
title: Back up and restore data
|
||||
- path: /desktop/opensource/
|
||||
title: Open source licensing
|
||||
- sectiontitle: Docker Hub
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
---
|
||||
title: Back up and restore data
|
||||
keywords: Docker Desktop, backup, restore, migration, reinstall, containers, images, volumes
|
||||
---
|
||||
|
||||
You can use the following procedure to save and restore images and container data.
|
||||
For example to reset your VM disk or to move your Docker environment to a new
|
||||
computer.
|
||||
|
||||
## Save your data
|
||||
|
||||
1. If you have containers that contain data that must be backed up, commit those
|
||||
containers to an image with [`docker container commit`](../engine/reference/commandline/commit.md).
|
||||
|
||||
Committing a container stores the container filesystem changes and some of the
|
||||
container's configuration (labels, environment-variables, command/entrypoint)
|
||||
as a local image. Be aware that environment variables may contain sensitive
|
||||
information such as passwords or proxy-authentication, so care should be taken
|
||||
when pushing the resulting image to a registry.
|
||||
|
||||
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
|
||||
(see step 3 below).
|
||||
|
||||
Refer to the [`docker container commit` page](../engine/reference/commandline/commit.md)
|
||||
in the Docker Engine command line reference section for details on using this
|
||||
command.
|
||||
|
||||
> Should I back up my containers?
|
||||
>
|
||||
> If you use volumes or bind-mounts to store your container data, backing up
|
||||
> your containers may not be needed, but make sure to remember the options that
|
||||
> were used when creating the container or use a [Docker Compose file](../compose/compose-file/index.md)
|
||||
> if you want to re-create your containers with the same configuration after
|
||||
> re-installation.
|
||||
|
||||
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).
|
||||
Make sure to configure the [repository's visibility as "private"](../docker-hub/repos.md#private-repositories)
|
||||
for images that should not be publicly accessible. Refer to the [`docker push` page](../engine/reference/commandline/push.md)
|
||||
in the Docker Engine command line reference section for details on using this
|
||||
command.
|
||||
|
||||
Alternatively, use [`docker image save -o images.tar image1 [image2 ...]`](../engine/reference/commandline/save.md)
|
||||
to save any images you want to keep to a local tar file. Refer to the
|
||||
[`docker image save` page](../engine/reference/commandline/save.md) in the
|
||||
Docker Engine command line reference section for details on using this command.
|
||||
|
||||
3. If you use [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.
|
||||
|
||||
After backing up your data, you can uninstall the current version of Docker Desktop
|
||||
and install a different version ([Windows](../docker-for-windows/install.md)
|
||||
[macOS](../docker-for-mac/install.md), or reset Docker Desktop to factory defaults.
|
||||
|
||||
## Restore your data
|
||||
|
||||
1. Use [`docker pull`]((../engine/reference/commandline/load.md)) to restore images
|
||||
you pushed to Docker Hub in "step 2." in the [save your data section](#save-your-data)
|
||||
|
||||
If you backed up your images to a local tar file, use [`docker image load -i images.tar`](../engine/reference/commandline/load.md)
|
||||
to restore previously saved images.
|
||||
|
||||
Refer to the [`docker image load` page](../engine/reference/commandline/load.md)
|
||||
in the Docker Engine command line reference section for details on using this
|
||||
command.
|
||||
2. 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.
|
||||
3. Re-create your containers if needed, using [`docker run`](../engine/reference/commandline/load.md),
|
||||
or [Docker Compose](../compose/index.md).
|
|
@ -74,35 +74,17 @@ When an update is available, Docker Desktop automatically downloads it to your m
|
|||
|
||||
## Uninstall Docker Desktop
|
||||
|
||||
To unistall Docker Desktop from your Mac:
|
||||
To uninstall Docker Desktop from your Mac:
|
||||
|
||||
1. From the Docker menu, select **Troubleshoot** and then select **Uninstall**.
|
||||
2. Click **Uninstall** to confirm your selection.
|
||||
|
||||
> **Note:** Uninstalling Docker Desktop will destroy Docker containers and images local to the machine and remove the files generated by the application.
|
||||
|
||||
### Save and restore data
|
||||
|
||||
You can use the following procedure to save and restore images and container data. For example to reset your VM disk:
|
||||
|
||||
1. Use `docker save -o images.tar image1 [image2 ...]` to save any images you
|
||||
want to keep. See [save](/engine/reference/commandline/save) in the Docker
|
||||
Engine command line reference.
|
||||
|
||||
2. Use `docker export -o myContainner1.tar container1` to export containers you
|
||||
want to keep. See [export](/engine/reference/commandline/export) in the
|
||||
Docker Engine command line reference.
|
||||
|
||||
3. Uninstall the current version of Docker Desktop and install a different version (Stable or Edge), or reset your VM disk.
|
||||
|
||||
4. Use `docker load -i images.tar` to reload previously saved images. See
|
||||
[load](/engine/reference/commandline/load) in the Docker Engine.
|
||||
|
||||
5. Use `docker import -i myContainer1.tar` to create a filesystem image
|
||||
corresponding to the previously exported containers. See
|
||||
[import](/engine/reference/commandline/import) in the Docker Engine.
|
||||
|
||||
For information on how to back up and restore data volumes, see [Backup, restore, or migrate data volumes](/storage/volumes/#backup-restore-or-migrate-data-volumes).
|
||||
> **Important**
|
||||
>
|
||||
> Uninstalling Docker Desktop destroys Docker containers, images, volumes, and
|
||||
> other Docker related data local to the machine, and removes the files generated
|
||||
> by the application. Refer to the [back up and restore data](../desktop/backup-and-restore.md)
|
||||
> section to learn how to preserve important data before uninstalling.
|
||||
|
||||
## Where to go next
|
||||
|
||||
|
@ -111,4 +93,6 @@ For information on how to back up and restore data volumes, see [Backup, restore
|
|||
to run and submit diagnostics, and submit issues.
|
||||
- [FAQs](../desktop/faqs.md) provide answers to frequently asked questions.
|
||||
- [Release notes](release-notes.md) lists component updates, new features, and improvements associated with Docker Desktop releases.
|
||||
- [Get started with Docker](/get-started/) provides a general Docker tutorial.
|
||||
- [Get started with Docker](../get-started/index.md) provides a general Docker tutorial.
|
||||
* [Back up and restore data](../desktop/backup-and-restore.md) provides instructions
|
||||
on backing up and restoring data related to Docker.
|
||||
|
|
|
@ -120,32 +120,13 @@ To uninstall Docker Desktop from your Windows machine:
|
|||
2. Select **Docker Desktop** from the **Apps & features** list and then select **Uninstall**.
|
||||
3. Click **Uninstall** to confirm your selection.
|
||||
|
||||
> **Note**
|
||||
> **Important**
|
||||
>
|
||||
> Uninstalling Docker Desktop will destroy Docker containers and images local to the machine and remove the files generated by the application.
|
||||
> Uninstalling Docker Desktop destroys Docker containers, images, volumes, and
|
||||
> other Docker related data local to the machine, and removes the files generated
|
||||
> by the application. Refer to the [back up and restore data](../desktop/backup-and-restore.md)
|
||||
> section to learn how to preserve important data before uninstalling.
|
||||
|
||||
### Save and restore data
|
||||
|
||||
You can use the following procedure to save and restore images and container data. For example, if you want to reset your VM disk:
|
||||
|
||||
1. Use `docker save -o images.tar image1 [image2 ...]` to save any images you
|
||||
want to keep. See [save](/engine/reference/commandline/save) in the Docker
|
||||
Engine command line reference.
|
||||
|
||||
2. Use `docker export -o myContainner1.tar container1` to export containers you
|
||||
want to keep. See [export](/engine/reference/commandline/export) in the
|
||||
Docker Engine command line reference.
|
||||
|
||||
3. Uninstall the current version of Docker Desktop and install a different version, or reset your VM disk.
|
||||
|
||||
4. Use `docker load -i images.tar` to reload previously saved images. See
|
||||
[load](/engine/reference/commandline/load) in the Docker Engine.
|
||||
|
||||
5. Use `docker import -i myContainer1.tar` to create a file system image
|
||||
corresponding to the previously exported containers. See
|
||||
[import](/engine/reference/commandline/import) in the Docker Engine.
|
||||
|
||||
For information on how to back up and restore data volumes, see [Backup, restore, or migrate data volumes](/storage/volumes/#backup-restore-or-migrate-data-volumes).
|
||||
|
||||
## Where to go next
|
||||
|
||||
|
@ -156,3 +137,5 @@ For information on how to back up and restore data volumes, see [Backup, restore
|
|||
how to get support.
|
||||
* [FAQs](../desktop/faqs.md) provides answers to frequently asked questions.
|
||||
* [Release notes](release-notes.md) lists component updates, new features, and improvements associated with Docker Desktop releases.
|
||||
* [Back up and restore data](../desktop/backup-and-restore.md) provides instructions
|
||||
on backing up and restoring data related to Docker.
|
||||
|
|
Loading…
Reference in New Issue