dongzhi5846 2019-01-14 07:11
浏览 177
已采纳

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

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

  • 写回答

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,
        "",
    )
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?