0

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

1 Answers1

0

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,
    "",
)
blobdon
  • 1,176
  • 7
  • 11
  • This definitely *does not* work. Instead, it causes a folder named `/app:z` to be created on the host and mounted. – Herohtar Feb 11 '22 at 21:12