question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Docker] Environment variable: PUID and PGID

See original GitHub issue

Description

Hello. As i want to run more secure environment of my homelab, i don’t want to run any docker container as root.

Suggestion: Every Linuxserver image has it’s common environment variables like TZ (timezone), PUID (user ID of user that will run the container), PGID (group ID of user that will run the container). Those last two i’d like to see also in Homarr. Many docker images of countless projects have it.

Things i tried: As i’m managing my container in Portainer Web UI, i needed to select different way of achieving user definition. Docker itself has --user: 1000:1000 which defines which user will run the container.

  • This can be easily done by going to Container -> Labels -> write name user and value 1000:1000. However, this didn’t work.

Priority

High (App breaking feature)

Please tick the boxes

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
walkxcodecommented, Jun 21, 2022

I don’t think PUID and GUID has anything to with NextJS, as @Pheggas said it’s just defining which user and group the docker container uses. I have no idea how to pass this to the actual container, but I’ll do some research.

0reactions
ntriggerscommented, Aug 21, 2022

hello, this does not seem to address the issue if I understand correctly … root user is still used in container and config files are created with root. my docker compose file :

---
version: '3'
services:
  homarr:
    container_name: homarr
    image: ghcr.io/ajnart/homarr:latest
    environment:
      - PUID=998
      - PGID=100
      - TZ=Europe/Paris
    volumes:
      - /home/admin/configs/homarr/configs:/app/data/configs
      - /home/admin/configs/homarr/icons:/app/public/icons
    restart: unless-stopped
    ports:
      - '7575:7575'

content of conf folder :

/home/admin/configs/homarr $ ll
total 16
drwxr-xr-x  4 root  root  4096 Aug 21 14:57 .
drwxr-xr-x 25 admin users 4096 Aug 21 14:57 ..
drwxr-xr-x  2 root  root  4096 Aug 21 15:01 configs
drwxr-xr-x  2 root  root  4096 Aug 21 14:57 icons
Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding PUID and PGID - LinuxServer.io
Using the PUID and PGID allows our containers to map the container's internal user to a user on the host machine. All of...
Read more >
How does PUID/PGID actually work in docker - Reddit
PUID and PGID are the ids of the user and group you want to use for the container. This is useful so you...
Read more >
Difference between PGID/PUID and GID/UID when setting up ...
Using the PUID and PGID allows our containers to map the container's internal user to a user on the host machine. All of...
Read more >
[Feature] Add PUID and PGID environment variables to run ...
I would like to run changedetection.io as a particular user, which would solve a lot of permission issues. In all LSIO containers I...
Read more >
Help me understand the benefits of rootless docker over PUID ...
It supports running the application internally as a non-root user via su-exec and PUID/PGID environment variables.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found