如何从已移除的Docker容器中检索卷? [英] how to retrieve volume from a removed Docker container?
问题描述
如果我有一个数据卷容器,我停止&删除容器(没有-v标志将删除卷),是否仍然可以启动一个新的数据卷容器与孤立的卷?还是数据丢失?
If I have a data volume container, and I stop & remove the container (without the -v flag which would remove the volume), is it still possible to start a new data volume container with the orphaned volume? Or is the data lost?
推荐答案
如果您删除带有 docker rm
但没有 -v
标志,您的数据仍然可以在 / var / lib / docker / vfs / dir / -volume-id> /
目录。
If you remove a container with docker rm
but without the -v
flag, your data will still be available inside the /var/lib/docker/vfs/dir/<your-volume-id>/
directory on the host.
要在新的docker容器中使用孤立的卷,您可以挂载该目录从主机或附加一个新的空卷到你的码头集装箱&然后同步数据。
To use the orphaned volume in a new docker container, you can either mount that directory from the host or attach a new empty volume to your docker container & then sync the data.
这篇关于如何从已移除的Docker容器中检索卷?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!