WithBindMount is broken on Fedora, RHEL and derivatives.
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
`WithBindMount` doesn't work on SELinux systems because the src directories don't have the right labels.
For example:
```
$ podman run --rm --mount type=bind,src=$(mktemp -d),target=/mnt docker.io/library/busybox:latest ls /mnt
ls: can't open '/mnt': Permission denied
```
The `relabel` option needs to be added with either a `private` or `shared` value. See [podman --mount](https://docs.podman.io/en/v4.4/markdown/options/mount.html).
For example:
```
$ podman run --rm --mount type=bind,src=$(mktemp -d),target=/mnt,relabel=shared docker.io/library/busybox:latest ls /mnt
/tmp/AspireExample/AspireExample.AppHost
$ podman run --rm --mount type=bind,src=$(mktemp -d),target=/mnt,relabel=private docker.io/library/busybox:latest ls /mnt
```
The difference between `private` and `shared` is whether multiple containers can share the volume.
Rather than expose this to the user, because the Aspire orchestrator is meant for development it could unconditionally add `,relabel=shared`.
From the [Docker documentation](https://docs.docker.com/storage/bind-mounts/), it seems that the `--mount` argument doesn't support relabeling. It can be done by using `-v` instead of `--mount` and adding `:z` for _shared_ (or `:Z` for _private).
Afaik on systems that don't support SELinux, passing this setting does not cause an error and it is ignored.
Contributor guide
Assessment
This issue has not been assessed yet.