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 |
Answered by
CorentinTh
Oct 29, 2024
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 hereAlso 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-dataLet me know if this resolves the issue or if you encounter any other problems |
0 replies
Answer selected by
CorentinTh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @adoyle-h
To set the UID and GID correctly in a rootless Docker container, you can specify them directly in your
docker-compose.ymlfile by using theuserproperty. Update yourdocker-compose.ymllike 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