Can Docker containers (NOT Docker images) be moved

2019-02-25 18:15发布

问题:

I found this information on the Docker Website

Docker containers can be run, started, stopped, moved, and deleted.

As far as I know, Docker-Images can be moved and Docker-Containers can't. But the information above stands clearly below the headline "Docker containers".

So I would like to know, whether containers could be moved or not (and if not: What is meant with "Docker containers can be moved").

Thanks!

回答1:

You can save a container with

docker save see https://docs.docker.com/reference/commandline/cli/#save

and restore them otherwhere with

docker load see https://docs.docker.com/reference/commandline/cli/#load (it is just a tar file)

but keep in mind this will not save the volumes of the container

https://docs.docker.com/userguide/dockervolumes/#data-volumes

nor the associated volumes from

https://docs.docker.com/userguide/dockervolumes/#creating-and-mounting-a-data-volume-container

For that there is a project

docker-backup https://github.com/discordianfish/docker-backup



标签: docker