I’m setting up a simple postgres/node container with docker-compose but when I try to run it with podman it fails because the container doesn’t have permissions to access the database directory. When I run it with docker though the whole thing works. I’d like to be able to stick with podman so is there a permission I need to change or config for podman I’m forgetting?
I have docker-compose layered and I have tried adding :z
after the path but it doesn’t change the error. I have used keep-id
and tried setting the container use as postgres
and root
.
docker-compose.yml
services:
web:
image: node:lts
working_dir: /repository
depends_on:
- db
ports:
- '3000:4000'
volumes:
- ./:/repository # had to add :z after repo for first launch to fix permissions
command: 'npm start'
db:
image: postgres:14
env_file: .env
expose:
- '5432'
volumes:
- lab-01-db:/var/lib/postgresql/data
volumes:
lab-01-db:
errors:
Attaching to db-1, web-1
db-1 | chmod: changing permissions of '/var/lib/postgresql/data': Permission denied
db-1 | find: ‘/var/lib/postgresql/data’: Permission denied
db-1 | chown: changing ownership of '/var/lib/postgresql/data': Permission denied