Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Unable to open pwfile when using mosquitto Docker image

Hi Giles,

the mosquitto Docker container is expecting two different volumes to be mounted in the container (as you might be able to check using the "docker image inspect mosquitto:latest“ and check for Volumes)
1. /mosquitto/config 
2. /mosquitto/data

If you simply try to mount your local /volume1/mosquitto to the internal /mosquitto still the subfolders config and data will not be visible in the container (as they are overloaded by the docker engine). This is a general pattern in docker engine: All specified volumes have to be mounted individually. You can’t simply mount the folder above.

To fix your problem you would need to mount your local data and config individually into the container:
sudo docker run --rm -i -p 1883:1883 -v /volume1/mosquitto/config:/mosquitto/config  -v /volume1/mosquitto/data:/mosquitto/data  eclipse-mosquitto:latest

Hope this helps.

BTW: Why are there two different folder ?
Because the folder contain two different types of data. Config contains seldom modified data, which contains highly sensitive data like usernames and password (hashes). The data folder store temporary data and maybe modified very often. Using two different folders allows to use different backend storages (e.g. different RAID configs).


Am 11.03.2022 um 07:01 schrieb Giles Roadnight <giles.roadnight@xxxxxxxxx>:

Hi All

I am trying to get mosquitto docker to work with a password file.  my run command:

sudo docker run --rm -i -p 1883:1883 -v/volume1/mosquitto:/mosquitto eclipse-mosquitto:latest

my config (/volume1/mosquitto/config/mosquitto.conf):

listener 1883
password_file /mosquitto/data/mosquitto.password_file

container file structure:

(there are 2 copies of password at 2 different locations)

Within the running container I can see the mqtt_passwd in /mosquitto/ but the mosquitto.password_file is missing from /mosquitto/data - I have no idea how that can happen.

If I change my config to point to the password file at /mosquitto/mqtt_passwd I get the same error:

1646978185: mosquitto version 2.0.14 starting
1646978185: Config loaded from /mosquitto/config/mosquitto.conf.
1646978185: Error: Unable to open pwfile "/mosquitto/mqtt_password".
1646978185: Error opening password file "/mosquitto/mqtt_password".

I am very new to docker and pretty new to linux so I am a bit lost. Any help much appreciated.
mosquitto-dev mailing list
To unsubscribe from this list, visit

Norbert Heußer
Senior Developer | Cedalo GmbH
Tel: +49 173 936 43 63

Cedalo GmbH
The company behind Eclipse Mosquitto and Eclipse Streamsheets

Geschäftsführer: Philipp Struss, Philip Ackermann, Dr. Stefan Lölkes Registergericht: Amtsgericht Freiburg, HRB 725414


Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

Back to the top