猿问

使用 docker golang 库的卷安装选项“z”

如何使用 docker golang 库为卷挂载传递 z 标志?用于支持 Selinux



慕桂英546537
浏览 98回答 1
1回答

缥缈止盈

我认为您可以将 ':z' 添加到卷的路径中,这是一个字符串:res, err := client.ContainerCreate(&nbsp; &nbsp; ctx,&nbsp; &nbsp; &container.Config{&nbsp; &nbsp; &nbsp; &nbsp; Image: "nginx",&nbsp; &nbsp; &nbsp; &nbsp; Cmd:&nbsp; &nbsp;[]string{},&nbsp; &nbsp; },&nbsp; &nbsp; &container.HostConfig{&nbsp; &nbsp; &nbsp; &nbsp; Mounts: []mount.Mount{&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Type:&nbsp; &nbsp;mount.TypeVolume,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Source: "/app:z",&nbsp; &nbsp;// <---- HERE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Target: "/target",&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },&nbsp; &nbsp; &nbsp; &nbsp; },&nbsp; &nbsp; },&nbsp; &nbsp; nil,&nbsp; &nbsp; "",)
随时随地看视频慕课网APP

相关分类

Go
我要回答