containers / containers/podman-compose
Access denied in container because volume is mounted as root, with non-root container
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 622
- PR merge metrics
- No merged PRs in 30d
Description
I have the same problem with bitnami/mysql, the process runs with UID 1001 ( as reported inside the container), but the volume is mounted with the root as owner, and with readonly:
```
podman run --rm -it --mount type=bind,source=/media/containers/podman/richard/storage/volumes/api_db/_data,destination=/bitnami/mysql,bind-propagation=z bitnami/mysql:5.7 bash
mysql 14:55:41.41
mysql 14:55:41.41 Welcome to the Bitnami mysql container
mysql 14:55:41.41 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mysql
mysql 14:55:41.41 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mysql/issues
mysql 14:55:41.41 Send us your feedback at containers@bitnami.com
mysql 14:55:41.41
1001@15dc89c7d81c:/$ ls -la /bitnami/mysql
total 8
drwxr-xr-x 2 root root 4096 Jan 2 12:57 .
drwxr-xr-x 3 root root 4096 Jan 2 06:56 ..
1001@15dc89c7d81c:/$ echo $UID
1001
1001@15dc89c7d81c:/$
```
My docker compose file:
```yaml
version: "3.5"
services:
db:
restart: unless-stopped
image: bitnami/mysql:5.7
ports:
- 127.0.0.1:3309:3306
environment:
- MYSQL_ROOT_PASSWORD=xxx
- MYSQL_DATABASE=xxx
volumes:
- db:/bitnami/mysql
volumes:
db: ~
```
_Originally posted by @Richard87 in https://github.com/containers/podman-compose/issues/41#issuecomment-570231831_
Contributor guide
Assessment
This issue has not been assessed yet.