-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
I'm using postgres:18-alpine, I see docker-entrypoint.sh has below function:
# used to create initial postgres directories and if run as root, ensure ownership to the "postgres" user
docker_create_db_directories()So I get a folder structure like below:
d4c37975021b:/var/lib/postgresql# ls -haliF
total 12K
1441820 drwxrwxrwt 3 postgres postgres 4.0K Feb 4 02:24 ./
3300592 drwxr-xr-x 1 root root 4.0K Jan 29 19:38 ../
1441848 drwxr-xr-x 3 root root 4.0K Feb 4 02:24 18/I'm not an expert but it seems not reasonable, the parent folder /var/lib/postgresql is owned by postgres but the child folder var/lib/postgresql/18 is owned by root.
Why I see this as an issue because when I use docker compose, I set volumes as below:
volumes:
- pg-primary-data:/var/lib/postgresql/18/dockerbut due to there is a specified volume {"/var/lib/postgresql":{}} per docker inspect postgres:18-alpine --format="{{json .Config.Volumes}}", I can see an additional anonymous volume in my docker volumes which seems annoying and dirty
$ docker volume ls
DRIVER VOLUME NAME
local 3249f229cb89fa25bfbec17295178522f7244ec19e59559e1fb1b6ad9c4c40c4
local my-pg-clusters_pg-primary-data
Could you please advice if this is intended? Is there any best practice to get around this? Or it is something can be optimized later? Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels