Running as a different user
By default the container is running with user root
and group root
.
You can change the user and group by using the PUID
and PGID
environment variables.
Important to note is, that you'll also need to change the permissions for the mounted directories accordingly.
When starting up an updated version of the container it will have about 10 seconds longer to start as it has to change the permissions of the app directories
Without mounted Docker socket​
To run your container as a different user, you can use the PUID
and PGID
environment variables:
#---------------------------------------------------------------------#
# Homarr - A simple, yet powerful dashboard for your server. #
#---------------------------------------------------------------------#
services:
homarr:
container_name: homarr
image: ghcr.io/homarr-labs/homarr:latest
restart: unless-stopped
volumes:
- ./homarr/appdata:/appdata
environment:
- SECRET_ENCRYPTION_KEY=your_64_character_hex_string # <--- can be generated with `openssl rand -hex 32`
- PUID=1000
- PGID=1000
ports:
- '7575:7575'
After that you'll need to create the appdata directory and set the correct permissions:
mkdir -p ./homarr/appdata
chown -R 1000:1000 ./homarr/appdata
With mounted Docker socket​
If you want to use the Docker integration, you'll need to set the correct permissions for the Docker socket as well, most of the times it will have the owner group set to docker group. In any way, it is recommended to create this group and set it's permissions to it, if it doesn't exist yet:
groupadd -g 999 docker
Then you can set the permissions for the Docker socket:
chown root:docker /var/run/docker.sock
After that you can set the PUID
and PGID
environment variables in your docker-compose.yml
file:
#---------------------------------------------------------------------#
# Homarr - A simple, yet powerful dashboard for your server. #
#---------------------------------------------------------------------#
services:
homarr:
container_name: homarr
image: ghcr.io/homarr-labs/homarr:latest
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./homarr/appdata:/appdata
environment:
- SECRET_ENCRYPTION_KEY=your_64_character_hex_string # <--- can be generated with `openssl rand -hex 32`
- PUID=1000
- PGID=999
ports:
- '7575:7575'
And set the permissions for the mounted directories:
mkdir -p ./homarr/appdata
chown -R 1000:999 ./homarr/appdata
Important here is that the group ID is set to 999
as we created the docker
group with this ID.