备份运行的Docker容器? [英] Backup a running Docker container?
问题描述
是否可以备份正在运行的Docker容器? export
命令是否适合这样做?
Is it possible to backup a running Docker container? Is the export
command suitable for doing that?
推荐答案
朋友在评论中
Hi Slava,抱歉您的问题已关闭。为了记录,Slava正在谈论docker.io,一个linux容器的运行时。是的, docker export
是一种合适的方法。它将生成整个容器文件系统状态的tarball,并将其转储到stdout上。所以
Hi Slava, sorry that your question was closed. For the record, Slava is talking about docker.io, a runtime for linux containers. Yes, docker export
is a suitable approach. It will generate a tarball of your entire container filesystem state, and dump it on stdout. So
docker export $ CONTAINER_ID> $ CONTAINER_ID-backup.tar
将产生可用的压缩包。您可以使用
will yield a usable tarball. You can re-import the tarball with
docker import - slava / $ CONTAINER_ID-backup& $ CONTAINER_ID-backup.tar
注意原始元数据(例如原始图像的ID)将丢失。这在Docker的将来版本中应该是固定的。
- Solomon Hykes 4月2日13日6:35
Note the original metadata (eg id of the original image) will be lost. This should be fixed in future versions of docker. – Solomon Hykes Apr 2 '13 at 6:35
在这里添加一个可以从摘要中找到问题的答案。谢谢所罗门!
Adding here so one can find from summary that question was answered. Thanks Solomon!
这篇关于备份运行的Docker容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!