Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writable directories with rootless Podman

I'm trying to run rootless Podman containers with

podman container create --name postgres --expose 5432 --memory 512M --hostname postgres --volume /home/user/some/path/postgres:/var/lib/postgresql/data:Z,U --userns keep-id --env POSTGRES_USER=admin --env POSTGRES_PASSWORD=secret docker.io/postgres:14

but I'm getting the error message

Error: error stat'ing file `/home/user/some/path/postgres`: Permission denied: OCI permission denied

The destination path /home/user/some/path is within a gocryptfs mount. Mapping the volume outside the path works flawlessly.

So far I thought that --userns keep-id should avoid permission issues for rootless containers but if I'm removing the option I'm getting the error message

chown: changing ownership of '/var/lib/postgresql/data': Operation not permitted

As far as I understood, providing the options --uidmap and --gidmap could help as well but I'm not sure how I can provide the proper values for it.

Under the hood I'm using Ansible to configure the containers.

EDIT: Now I also created a Podman issue.

like image 492
alexanderadam Avatar asked Apr 29 '26 05:04

alexanderadam


1 Answers

The reason for this error was that the mount wasn't done with the fuse parameter allow_other.

like image 123
alexanderadam Avatar answered Apr 30 '26 22:04

alexanderadam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!