dongzhi5846
2019-01-14 07:11
浏览 110

使用docker golang库的卷挂载选项'z'

How to pass z flag for volume mount using docker golang library ? For supporting Selinux

图片转代码服务由CSDN问答提供 功能建议

如何使用docker golang库通过z标志进行卷挂载? 用于支持Selinux < / DIV>

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongmi1941 2019-01-14 22:20
    已采纳

    I would think you can just add ':z' to the path of the volume, which is a string:

    res, err := client.ContainerCreate(
        ctx,
        &container.Config{
            Image: "nginx",
            Cmd:   []string{},
        },
        &container.HostConfig{
            Mounts: []mount.Mount{
                {
                    Type:   mount.TypeVolume,
                    Source: "/app:z",   // <---- HERE
                    Target: "/target",
                },
            },
        },
        nil,
        "",
    )
    
    点赞 打赏 评论

相关推荐 更多相似问题