How to back up and restore your Docker Desktop data
Page options
Page options
Use this procedure to back up and restore your images and container data. This is useful if you want to reset your VM disk or to move your Docker environment to a new computer.
Important
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 if you want to re-create your containers with the same configuration after re-installation.
Save your data
Commit your containers to an image with
docker container commit
.Committing a container stores filesystem changes and some container configurations, such as labels and environment variables, as a local image. Be aware that environment variables may contain sensitive information such as passwords or proxy-authentication, so take care when pushing the resulting image to a registry.
Also note that filesystem changes in a 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 to store container data, such as databases, refer to the back up, restore, or migrate data volumes page in the storage section.
Use
docker push
to push any images you have built locally and want to keep to the Docker Hub registry.Tip
Set the repository visibility to private if your image includes sensitive content.
Alternatively, use
docker image save -o images.tar image1 [image2 ...]
to save any images you want to keep to a local.tar
file.
After backing up your data, you can uninstall the current version of Docker Desktop and install a different version or reset Docker Desktop to factory defaults.
Restore your data
Load your images.
If you pushed to Docker Hub:
$ docker pull <my-backup-image>
If you saved a
.tar
file:$ docker image load -i images.tar
Re-create your containers if needed, using
docker run
, or Docker Compose.
To restore volume data, refer to backup, restore, or migrate data volumes.