Jay Hill
Jay Hill

Reputation: 23

Error when passing edited conf file to mosquitto in docker container

I get this error when trying to run mosquitto docker on ubuntu.

docker: Error response from daemon: source /var/lib/docker/overlay2/a9ce020a555f57/merged/mosquitto/config/mosquitto.conf is not directory.

I'm running this command.

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

Upvotes: 2

Views: 2169

Answers (1)

Brits
Brits

Reputation: 18280

From the docker docs

When you use a bind mount, a file or directory on the host machine is mounted into a container. The file or directory is referenced by its absolute path on the host machine.

So you have to pass the full (absolute) path to the mosquitto.conf e.g. /home/jay/mosquitto/mosquitto.conf (see this issue for info on why). You can get your shell to help:

sudo docker run -it -p 1883:1883 -p 9001:9001 -v "$(pwd)"/mosquitto.conf:/mosquitto/config/mosquitto.conf eclipse-mosquitto

Upvotes: 3

Related Questions