Hi !
I have Openmediavault installed on a custom NAS.
On this host, I created a user “dockeruser” with uid 1001 and gid 100 (users).
As a good security practice, I want to use this user to run all my containers, to be sure that files & dirs created by the container on the host are owned by this user and not root user.
First I deployed Portainer container using Docker Compose service in Openmediavault.
Here is the docker-compose file :
services:
portainer-ee:
networks:
- wolvenet
ports:
- '8000:8000'
- '9000:9000'
container_name: portainer
environment:
- PUID=1001
- PGID=100
- TZ=Europe/Paris
restart: always
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
- '/srv/dev-disk-by-uuid-a8170b8f-7d4d-4d2a-8c35-3fb1a4aa33f8/docker-share/appdata/portainer/portainer_data:/data'
image: 'portainer/portainer-ee:latest'
networks:
wolvenet:
external: true
And then, I deploy my container with docker-compose Stack in Portainer.
My problem is, when I deploy or update a Stack in Portainer, docker-compose.yml file and directories created in /portainer_data/compose are owned by root
As I used “- PUID=1001” and “- PGID=100” to deploy Portainer, why Portainer is using root user to create docker compose files and dirs ?