eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.94k stars 2.37k forks source link

Docker run doesn't work #2978

Open JavierYepez opened 8 months ago

JavierYepez commented 8 months ago

I'm trying to run a simple instance of mosquitto with the following command (taken from the docker page, examples):

docker run -it -p 1883:1883 -p 9001:9001 -v mosquitto.conf:/mosquitto/config/mosquitto.conf eclipse-mosquitto

And gives me the following error: docker: Error response from daemon: source /var/lib/docker/overlay2/7afb6a2079ceaf6bc03bb9c5c35122ba077e8c4ed90da30d96e945d4452e6869/merged/mosquitto/config/mosquitto.conf is not directory. See 'docker run --help'.

Running on a 2019 MacBook Docker Desktop: 4.25.2

dopefishh commented 8 months ago

I also ran into this and figured out that you need to use a full path. E.g.:

docker run -it -v $PWD/mosquitto.conf:/mosquitto/config/mosquitto.conf -p 1883:1883 -p 9001:9001 eclipse-mosquitto
JavierYepez commented 8 months ago

But that's weird, it should work with the relative path though. I was launching Mosquitto from a Docker Compose and it doesn't makes sense to use absolute path. Is there a way to do $PWD when mounting from a Docker Compose file?

dopefishh commented 8 months ago

I don't know whether a full path is required in Docker Compose, only that it is required when using the docker directly. The docker documentation (https://docs.docker.com/storage/bind-mounts/) also states:

... The file or directory is referenced by its absolute path on the host machine. ...

JavierYepez commented 8 months ago

Then they should update/fix their examples here https://hub.docker.com/_/eclipse-mosquitto