I’m rebuilding my Docker system on a Raspberry Pi (Raspbian Bullseye / 11 64bit Arm8) this time using docker rootless. This went OK following this guide How to Run Rootless Docker Containers
I then installed the docker compose plugin. Next I installed Portainer in rootless mode following this guide Portainer and rootless Docker and was able to access from a web browser on my LAN.
I could not find a rootless guide for Eclipse Mosquitto so using the Portainer compose as a template installed it. However I cannot access it from a web browser on my LAN. I’ve spent many hours looking for a solution without success,
Here is my compose file:
version: "3.8"
services:
portainer:
image: portainer/portainer-ce
container_name: portainer
restart: always
volumes:
- /$XDG_RUNTIME_DIR/docker.sock:/var/run/docker.sock
- ~/.local/share/docker/volumes:/var/lib/docker/volumes
- /home/hms/docker/portainer:/data
ports:
- 8000:8000
- 9000:9000
environment:
- TZ=Europe/London
mosquitto:
image: eclipse-mosquitto
container_name: mosquitto
restart: always
volumes:
- /$XDG_RUNTIME_DIR/docker.sock:/var/run/docker.sock
- /home/hms/docker/mosquitto/data:/mosquitto/data
- /home/hms/docker/mosquitto/config:/mosquitto/config
- /home/hms/docker/mosquitto/log:/mosquitto/log
ports:
- 1883:1883
- 9001:9001
environment:
- TZ=Europe/London
Looking at the settings via Portainer both containers are using the docker_default
However whilst Portainer is assigned IP address 172.18.0.2 the Mosquitto container has no IP address assigned.
Looking at Portainer’s network page:
Bridge is subnet 172.17.0.0/16 gateway 172.17.0.1
docker_default is subnet 172.18.0.0/16 gateway 172.18.0.1
host & none are not assigned
On my original and working docker installation mosquitto is defined with network_mode: “host” and I can access it with 192.168.1.yy:1883 from MQTT Explorer on a PC. Adding network_mode: “host” to my new setup does not work either using 192.168.1.zz:1883 . I get “disconnected from server”.
Update:
Here is my mosquitto.config file
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
listener 1883
## Authentication ##
allow_anonymous true
#password_file /mosquitto/conf/mosquitto.conf
and the the listen rootlesskit entries in sudo netstat -tulpn
Active Internet connections (only servers)
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 567/rootlesskit
tcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 567/rootlesskit
tcp6 0 0 :::8000 :::* LISTEN 567/rootlesskit
tcp6 0 0 :::9000 :::* LISTEN 567/rootlesskit
And the last entries in the mosquitto.log
1680865416: mosquitto version 2.0.15 starting
1680865416: Config loaded from /mosquitto/config/mosquitto.conf.
1680865416: Opening ipv4 listen socket on port 1883.
1680865416: Opening ipv6 listen socket on port 1883.
1680865416: mosquitto version 2.0.15 running
Suggestions please.
Alan