Skip to content

feature addition: docker image supporting PUID/PGID - #3717

Draft
march42 wants to merge 4 commits into
eclipse-mosquitto:masterfrom
march42:add/PUID-PGID
Draft

march42 wants to merge 4 commits into
eclipse-mosquitto:masterfrom
march42:add/PUID-PGID

Conversation

@march42

@march42 march42 commented Aug 18, 2026

Copy link
Copy Markdown

I am running eclipse-mosquitto in docker, using a modified image with support for setting PUID/PGID.

  • The image is based on 2.1-alpine.
  • Package daemontools-encore provides needed setuidgid
  • Package shadow provides needed groupmod and usermod
  • docker-entrypoint.sh
    • modifies GID of group mosquitto
    • modifies UID and primary GID of user mosquitto
    • changes ownership of /mosquitto
    • starts configured CMD (rely on mosquitto dropping root privileges)
  • fixes Add Support for PGID and PUID Docker Enviroment Variables #2441

For testing, the current image can be pulled from Docker hub image marchefter/eclipse-mosquitto:appuser.

services:
  mosquitto:
    image: marchefter/eclipse-mosquitto:appuser
    healthcheck:
      test: ["CMD-SHELL", "/usr/bin/mosquitto_sub -C 1 --topic '$$SYS/broker/uptime' 2>/dev/null || exit 1"]
    environment:
      TZ: "Europe/Berlin"
      PUID: 2388
      PGID: 1763
    ports:
      - "1883:1883" # default mqtt port
      - "8883:8883" # mqtt TLS port
    volumes:
      - ./mosquitto_config:/mosquitto/config
      - ./mosquitto_data:/mosquitto/data
      - ./mosquitto_log:/mosquitto/log

@march42
march42 marked this pull request as draft September 1, 2026 09:21
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

Successfully merging this pull request may close these issues.

Add Support for PGID and PUID Docker Enviroment Variables

1 participant