Homarr
Advanced

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.

At startup, Homarr updates ownership of its data directories and runtime caches for the selected user and group. Startup time depends on the amount of persistent data; application code and dependencies do not need ownership changes.

Without mounted Docker socket

To run your container as a different user, you can use the PUID and PGID environment variables:

docker-compose.yml
#---------------------------------------------------------------------#
#     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:

On host
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:

On host
groupadd -g 999 docker

Then you can set the permissions for the Docker socket:

On host
chown root:docker /var/run/docker.sock

After that you can set the PUID and PGID environment variables in your docker-compose.yml file:

docker-compose.yml
#---------------------------------------------------------------------#
#     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:

On host
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.

On this page