Can Docker containers (NOT Docker images) be moved

2019-02-25 17:56发布

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!

标签: docker
1条回答
我命由我不由天
2楼-- · 2019-02-25 18:24

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

查看更多
登录 后发表回答