微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Docker-compose 卷模式选项

如何解决Docker-compose 卷模式选项

在简短的语法 source:target:mode 中,官方文档只提到了 rorw 但在 cookiecutter template for django 中他们使用了其他两种模式:z 和 { {1}},我在任何地方都没有找到它们的参考资料,它们是什么?

解决方法

Docker run reference 文档:

-v,--volume=[host-src:]container-dest[:<options>]: Bind mount a volume.
The comma-delimited `options` are [rw|ro],[z|Z],[[r]shared|[r]slave|[r]private],and [nocopy].
The 'host-src' is an absolute path or a name value.

If neither 'rw' or 'ro' is specified then the volume is mounted in
read-write mode.

The `nocopy` mode is used to disable automatically copying the requested volume
path in the container to the volume storage location.
For named volumes,`copy` is the default mode. Copy modes are not supported
for bind-mounted volumes.

这些选项进一步记录在 (named) volume documentation(特别是 ro)和 bind mount documentation 中。

实际上,我从不需要这些选项中的任何一个,除非我碰巧部署到启用了 SELinux 的系统,那么 z 很有用。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。