Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for PGID and PUID Docker Enviroment Variables #2441

Open
matthewparkes opened this issue Jan 18, 2022 · 13 comments
Open

Add Support for PGID and PUID Docker Enviroment Variables #2441

matthewparkes opened this issue Jan 18, 2022 · 13 comments

Comments

@matthewparkes
Copy link

matthewparkes commented Jan 18, 2022

Version: 2.0.14

When persistenting data volumes all files are owned by user 1883

docker-compose.yml

services:

  #Eclipse Mosquitto
  mosquitto:
    container_name: eclipse-mosquitto
    image: eclipse-mosquitto:latest
    restart: unless-stopped
    environment:
      - PGID=1000
      - PUID=1000
      - UMASK_SET=000
    deploy:
      resources:
        limits:
          memory: 125M
    ports:
       - "1883:1883"
       - "9001:9001"
    volumes:
      - ./data-mosquitto/config:/mosquitto/config
      - ./data-mosquitto/data:/mosquitto/data
      - ./data-mosquitto/log:/mosquitto/log

~/data-mosquitto/config$ ls -l
drwxrwxr-x 2    1883    1883 4096 Jan 18 12:20 ./
drwxrwxr-x 5    user    user 4096 Jan 16 01:04 ../
-rw-r--r-- 1    1883    1883  207 Jan 18 12:20 mosquitto.conf
-rw-r--r-- 1    1883    1883  121 Jan 16 02:24 mosquitto.passwd

Can support for PGID and PUID be added so logs are easily viewble on host machine without ROOT?

Thanks

@thesebastianf
Copy link

I also ask for support of PGID and PUID as Environment variables of docker compose to be actually acknowledged.

@rursache
Copy link

rursache commented Jul 17, 2022

this should be priority no. 1

im using vimagick's docker image until this gets sorted out

ralight added a commit that referenced this issue Aug 11, 2022
These arefor setting the user/group to drop privileges to.

Closes #2441. Thanks to matthewparkes.
@FerronN
Copy link

FerronN commented Sep 17, 2022

Why is this change only done for the local docker file?

@amooz
Copy link

amooz commented Oct 19, 2022

Also running into this, always uid/gid 1883.

@SgtErnestBilko
Copy link

It would be really useful if this issue were 'sorted'..... please

@degudejung
Copy link

+1 for me!

@zeppmg
Copy link

zeppmg commented Mar 14, 2023

Hello,
It seems to me that the "user" parameter does the trick :

services:
  mosquitto:
    image: eclipse-mosquitto:latest
    container_name: mosquitto
    user: "1000:1000"
    [...]

@lox
Copy link

lox commented May 21, 2023

Setting user didn't work for me, files are still owned by 1883.

Accepting UID/GID/TZ is a really standard thing for docker containers to do, otherwise makes it very hard to map permissions back to the host.

@lox
Copy link

lox commented May 21, 2023

Looks like it's on the develop branch, might that make it into a release at some point @ralight?

@ctrl-f5
Copy link

ctrl-f5 commented Feb 13, 2024

2024 and this issue still persists. running this container on a system you dont have root access on makes the config file uneditable and config/data/log folders unremovable.

@mhoogenbosch
Copy link

Setting up a new environment and am really surprised this is still not fixed.

@SgtErnestBilko
Copy link

Setting up a new environment and am really surprised this is still not fixed.

I agree. Makes developing my docker stack a PIA, I can't sync to GitHub without excluding Mosquito config files.

@ltctceplrm
Copy link

Setting user didn't work for me, files are still owned by 1883.

It worked for me but I had to first stop mosquitto, chown the files with my PUID and GUID, update the docker compose and then restart it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests