mosquitto icon indicating copy to clipboard operation
mosquitto copied to clipboard

Docker run doesn't work

Open JavierYepez opened this issue 2 years ago • 4 comments

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

JavierYepez avatar Jan 12 '24 11:01 JavierYepez

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

dopefishh avatar Jan 26 '24 13:01 dopefishh

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?

JavierYepez avatar Jan 29 '24 09:01 JavierYepez

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. ...

dopefishh avatar Jan 29 '24 09:01 dopefishh

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

JavierYepez avatar Jan 29 '24 09:01 JavierYepez