containers / containers/podman-compose
volume mount for selinux z Z broken since 1.6.0
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 622
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Hi, since 1.6.0, selinux options (z and Z) to volume mount are not passed to the --mount options when the container is created.
It works fine on 1.5.0.
**To Reproduce**
With a container-compose.yml file
```
services:
db:
image: "docker.io/library/mariadb:latest"
volumes:
- db:/var/lib/mysql:Z
volumes:
db:
```
we are running `podman-compose up -d`
**Expected behavior**
I understand since this commit https://github.com/containers/podman-compose/commit/35ab67277252306354471dbb25e5eefc97c8b301 ,
the --mount is favored over -v, so the expected behavior would be the the podman create command contains `--mount type=volume,source=db,destination=/var/lib/mysql:Z`
**Actual behavior**
The podman create command actually used `--mount type=volume,source=db,destination=/var/lib/mysql`
(no Z)
**Output**
```
$ podman-compose version
podman-compose version 1.6.0
podman version 5.8.2
$ podman-compose up
...
INFO:__main__:['podman', '--version', '']
INFO:__main__:using podman version: 5.8.2
DEBUG:__main__:** excluding: set()
INFO:__main__:pulling images: ...
INFO:__main__:podman pull --policy missing docker.io/library/mariadb:latest
Trying to pull docker.io/library/mariadb:latest...
Getting image source signatures
Copying blob 8968c4a6b703 done |
Copying blob ca2678b20700 skipped: already exists
Copying blob 0509ab96435e done |
Copying blob d18d73b371db done |
Copying blob 7d139c1d2a03 done |
Copying blob f8917dad17dd done |
Copying blob 93f279b7c180 done |
Copying blob 8f0e385cdc59 done |
Copying config 73d2c069f7 done |
Writing manifest to image destination
73d2c069f75f0c7900c6bf85a1f48dad9071e0c1644fe804fd1d585f16a9134f
INFO:__main__:exit code: 0
INFO:__main__:building images: ...
INFO:__main__:['podman', 'ps', '--filter', 'label=io.podman.compose.project=tmp', '-a', '--format', 'json']
INFO:__main__:podman pod exists pod_tmp
INFO:__main__:exit code: 1
INFO:__main__:podman pod create --name=pod_tmp --infra=false --share=
8ff7d4b09a30f2c9ad2ab7060bb1d3d057f29ef32a86f6eff0f7ff541e32a93d
INFO:__main__:exit code: 0
INFO:__main__:creating missing containers: ...
DEBUG:__main__:podman volume inspect tmp_db || podman volume create tmp_db
INFO:__main__:['podman', 'volume', 'inspect', 'tmp_db']
INFO:__main__:['podman', 'volume', 'create', '--label', 'io.podman.compose.project=tmp', '--label', 'com.docker.compose.project=tmp', 'tmp_db']
INFO:__main__:['podman', 'volume', 'inspect', 'tmp_db']
INFO:__main__:['podman', 'network', 'exists', 'tmp_default']
INFO:__main__:['podman', 'network', 'create', '--label', 'io.podman.compose.project=tmp', '--label', 'com.docker.compose.project=tmp', 'tmp_default']
INFO:__main__:['podman', 'network', 'exists', 'tmp_default']
INFO:__main__:podman create --name=tmp_db_1 --pod=pod_tmp --label io.podman.compose.project=tmp --label io.podman.compose.version=1.6.0 --label PODMAN_SYSTEMD_UNIT=podman-compose@tmp.service --label com.docker.compose.project=tmp --label com.docker.compose.project.working_dir=/tmp --label com.docker.compose.project.config_files=container-compose.yml --label io.podman.compose.config-hash=50e2057100c33df60dc9bd0ad9e53d7184d47e6ccceed42cdb467053f91822b6 --label com.docker.compose.container-number=1 --label io.podman.compose.service=db --label com.docker.compose.service=db --mount type=volume,source=tmp_db,destination=/var/lib/mysql --network=tmp_default:alias=db docker.io/library/mariadb:latest
26a10a06591d2d33d1ebc9e0704485dc98b795b4a46d5e45dafc01db0b554085
INFO:__main__:exit code: 0
INFO:__main__:starting containers (detached): ...
DEBUG:__main__:Checking dependencies prior to container tmp_db_1 start
DEBUG:__main__:Starting task for container tmp_db_1
INFO:__main__:podman start tmp_db_1
tmp_db_1
INFO:__main__:exit code: 0
```
**Environment:**
- OS: Linux
- podman version: 5.8.2 on AlmaLinux 9
- podman compose version: 1.6.0
**Additional context**
Add any other context about the problem here.
Contributor guide
Research direction
Start with the podman-compose up -d path that converts the volume entry in container-compose.yml into the podman create --mount argument. Compare the 1.6.0 behavior with 1.5.0 and verify the MariaDB reproduction emits the requested :Z or :z option in the mount command.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, python
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100