Docker数据唯一容器的持久性如何 [英] How persistent are docker data-only containers

查看:244
本文介绍了Docker数据唯一容器的持久性如何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于仅数据的docker容器我有点困惑。我看到将目录直接挂载到源代码是一个糟糕的做法: https://groups.google.com/forum/#!msg/docker-user/EUndR1W5EBo/4hmJau8WyjAJ



我得到了如何仅数据容器: http://container42.com/2014/ 11/18 / data-only-container-madness /



我看到有些类似我的问题:如何处理docker中的持久存储(例如数据库)



但是,如果我有一个灯泡服务器设置..我有一切很好的设置与数据容器,而不是直接链接到我的源代码,并使备份一次。



比某人来的还要重新启动我的服务器..如何重新设置我的docker(仅数据) - 容器,所以我不会丢失任何数据?

解决方案

Docker容器将保留在磁盘上,直到它们被明确删除为 docker rm 。如果您的服务器重新启动,您可能需要重新启动服务容器,但您的数据容器将继续存在,并且其卷将可用于其他容器。


I'm a bit confused about data-only docker containers. I read it's a bad practice to mount directories directly to the source-os: https://groups.google.com/forum/#!msg/docker-user/EUndR1W5EBo/4hmJau8WyjAJ

And I get how I make data-only containers: http://container42.com/2014/11/18/data-only-container-madness/

And I see somewhat similar question like mine: How to deal with persistent storage (e.g. databases) in docker

But what if I have a lamp-server setup.. and I have everything nice setup with data-containers, not linking them 'directly' to my source-os and make a backup once a while..

Than someone comes by, and restarts my server.. How do I setup my docker (data-only)-containers again, so I don't lose any data?

解决方案

Docker containers will persist on disk until they are explicitly deleted with docker rm. If your server restarts you may need to restart your service containers, but your data containers will continue to exist and their volumes will be available to other containers.

这篇关于Docker数据唯一容器的持久性如何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆