docker重启后数据是否会丢失


当前第2页 返回上一页

python -m json.tool 可以将输出的json字符串格式化显示。

Source 表示主机上的目录,即 /tmp/source 。

Destination 为容器中的目录,即 /tmp/destination。

3. 本机文件可以同步到容器

在本机/tmp/source目录中新建hello.txt文件

touch /tmp/source/hello.txtls /tmp/source/hello.txt

hello.txt文件在容器/tmp/destination/目录中可见

使用 docker exec 命令,可以在容器中执行命令。

docker exectest ls /tmp/destination/hello.txt

所以在宿主机对目录 /tmp/source/ 的修改,可以同步到容器目录 /tmp/destination/ 中。

4. 容器文件可以同步到宿主机

在容器/tmp/destination目录中新建world.txt文件

docker exec test touch /tmp/destination/world.txtdocker exec test ls /tmp/destination/hello.txtworld.txt

world.txt文件在宿主机/tmp/source/目录中可见

ls /tmp/source/hello.txt world.txt

更多相关教程,请关注PHP中文网docker教程栏目。

以上就是docker重启后数据是否会丢失的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

linux下如何安装Docker

Docker数据卷有什么用

如何启动Docker

重启后怎么连接Docker

Docker如何选择ipv6地址段

运行Docker需要root权限吗

centos无法启动Docker的解决方法

怎么彻底卸载Docker

Docker的四种网络模式分别是?

Docker是做什么用的

更多相关阅读请进入《Docker》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...