How to set uid/gid in docker compose file with rootless? #305
-
I'm using rootless image. How to set uid/gid in docker compose file? I tried below config, but it prints logs services:
enclosed:
image: corentinth/enclosed:latest-rootless
ports:
- 8787:8787
volumes:
- ./enclosed-data:/app/.data
restart: unless-stopped
environment:
- PUID=1000
- PGID=1000 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @adoyle-h To set the UID and GID correctly in a rootless Docker container, you can specify them directly in your services:
enclosed:
image: corentinth/enclosed:latest-rootless
ports:
- 8787:8787
volumes:
- ./enclosed-data:/app/.data
restart: unless-stopped
user: "1000:1000" # Set UID and GID here Also make sure the enclosed-data directory on your host has permissions that match UID 1000 and GID 1000. You can update the permissions with: sudo chown -R 1000:1000 ./enclosed-data Let me know if this resolves the issue or if you encounter any other problems |
Beta Was this translation helpful? Give feedback.
Hi @adoyle-h
To set the UID and GID correctly in a rootless Docker container, you can specify them directly in your
docker-compose.yml
file by using theuser
property. Update yourdocker-compose.yml
like this:Also make sure the enclosed-data directory on your host has permissions that match UID 1000 and GID 1000. You can update the permissions with:
Let me know if this resolves the issue or if you encounter any other problems