Can't start container with existing volume.
Opened this issue · 3 comments
What is the bug or the crash?
I updated my application and needed to rebuild images, so I restarted my docker-compose and postgis container no longer starts. In container logs I see an error "ERROR: must be superuser to alter superuser roles or change superuser attribute". If i don't use volume or use new empty volume, container starts.
Fragment of my docker-compose.yml
my-app.db:
image: kartoza/postgis:14-3.3
restart: always
environment:
POSTGRES_PASSWORD: $DB_PASSWORD
POSTGRES_USER: $DB_USER
POSTGRES_DB: $DB_NAME
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}" ]
interval: 5s
timeout: 5s
retries: 5
ports:
- '5433:5432'
volumes:
- ./postgres-data:/var/lib/postgresql/14
Steps to reproduce the issue
_
Versions
kartoza/postgis:14-3.3
Additional context
No response
Can you try changing permission for your data directory before running postgres.
Wich permission directory should have?
Docker created directory postgres-data
drwxr-xr-x 3 root root 4096 postgres-data
postgres-data/main
drwxr-x--- 19 systemd-network systemd-network 4096 main
I suggest you check out the option to run the image as none root https://github.com/kartoza/docker-postgis#rootless-mode