Open SteffRainville opened 2 years ago
in another issue I found you need to modify
mosquitto.conf:/mosquitto/config/mosquitto.conf
to the absolute real path of the config file. the right part is the container, the left is where it is on the system. For my install I modified to (looks redundant)
/mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf
the conf file is in /mosquitto/config/mosquitto.conf on my system, so same on both sides of the :
I faced the same issue using docker in WSL2.
▶ If you have already installed mosquitto
in your machine and you want to use system's mqtt config, just like @kcossabo mentioned, use:
docker run -it -p 1883:1883 -p 9001:9001 -v /mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf eclipse-mosquitto
▶ But, if you do not have mosquitto
installed,
Create mosquito.conf
under current directory and add this default config:
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
allow_anonymous true
listener 1883
Use $(pwd)
to mount your current directory:
docker run -it -p 1883:1883 -p 9001:9001 -v $(pwd)/mosquitto.conf:/mosquitto/config/mosquitto.conf eclipse-mosquitto
Hope this works for you.
for me this comment helped: https://github.com/docker/for-linux/issues/675#issuecomment-648992857
I was using k8s config maps and there one has a directory to be mounted, hence the target should be a directory as well. So /mosquitto/config/ instead of /mosquitto/config/mosquitto.conf
however for you in docker your command should work as long as the conf file really exists.
Docker under Windows 10 using WSL Ubuntu
Following instructions from DockerHub
Fresh docker pull eclipse-mosquitto (2.0.11)
Trying to mount local configuration file to /mosquitto/config/mosquitto.conf
docker run -it -p 1883:1883 -p 9001:9001 -v mosquitto.conf:/mosquitto/config/mosquitto.conf eclipse-mosquitto
Getting error
docker: Error response from daemon: source /var/lib/docker/overlay2/5dd23c2c5fbc219073fae389d71dd33a63711a1b0562afc9edf4528a52d48624/merged/mosquitto/config/mosquitto.conf is not directory.
Tried it under
Command line Windows Powewr Shell WSL ubuntu
As well as under A Macbook Pro running Big Sur and Ubuntu 21.04
This is more a Docker issue than Mosquitto issue but since it's from the official Eclipse- Foundation image it might be appropriate to post here.