Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mosquitto/config/mosquitto.conf is not directory. #2258

Open
SteffRainville opened this issue Jul 20, 2021 · 3 comments
Open

mosquitto/config/mosquitto.conf is not directory. #2258

SteffRainville opened this issue Jul 20, 2021 · 3 comments

Comments

@SteffRainville
Copy link

SteffRainville commented Jul 20, 2021

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.

@kcossabo
Copy link

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 :

@theinhtut
Copy link

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.

@tonkolviktor
Copy link

for me this comment helped: docker/for-linux#675 (comment)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants