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重启后数据是否会丢失的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

两个Docker不同主机如何实现互相访问

Docker 可以用在哪些方面?

查看Docker的运行状态使用什么命令

Docker save和Docker export有什么区别

Docker如何更换国内仓库

连接Docker中的mysql失败怎么办

Docker如何通过代理上网

Docker怎么以root用户登录

windows关闭Docker后无法开机自启

如何在Docker容器中运行gui程序?

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



打赏

取消

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

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

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

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

评论

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