Open
Description
Creating a container with "user:1000:1000" in the compose file generates these errors:
chmod: /var/lib/postgresql/data: Operation not permitted
chmod: /var/run/postgresql: Operation not permitted
The files belonging to this database system will be owned by user "myrootlessuser".
This user must also own the server process.
...
fixing permissions on existing directory /var/lib/postgresql/data ... initdb: error: could not change permission of directory "/var/lib/postgresql/data": Operation not permitted
This seems to happen because i'm using a subuid (which the volume correctly chowns to the bind path)
A solution to this could be to let us set the postgres user UID and GID manually, as suggested in #1068
This works without using subuids, but doesn't if so:
services:
pgdbex:
image: postgres:16-alpine
cap_drop:
- ALL
user: 1000:1000
environment:
POSTGRES_USER:
POSTGRES_PASSWORD:
POSTGRES_DB:
volumes:
- ./db:/var/lib/postgresql/data
This doesn't work in either case:
services:
pgdbex:
image: postgres:16-alpine
cap_drop:
- ALL
user: 1000:1000
environment:
POSTGRES_USER:
POSTGRES_PASSWORD:
POSTGRES_DB:
volumes:
- pgdbdata:/var/lib/postgresql/data
volumes:
pgdbdata:
driver: local
driver_opts:
o: bind
type: none
device: ./db
Metadata
Metadata
Assignees
Labels
No labels