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

issue with docker container - Unable to open config file /mosquitto/config/mosquitto.conf #620

Closed
nicorazon opened this issue Nov 11, 2017 · 9 comments
Labels
Component: mosquitto-broker Status: Blocked Another issue needs to be resolved first

Comments

@nicorazon
Copy link

Hi Guys,

having issue with running the docker container, can someone please guide on the below errors?

Any help is appreciated..

Error: Unable to open config file /mosquitto/config/mosquitto.conf
Error found at /mosquitto/config/mosquitto.conf:32765.
Error: Unable to open configuration file.
Error: Unable to open config file /mosquitto/config/mosquitto.conf
Error found at /mosquitto/config/mosquitto.conf:32767.
Error: Unable to open configuration file.
Error: Unable to open config file /mosquitto/config/mosquitto.conf
Error found at /mosquitto/config/mosquitto.conf:32766.
Error: Unable to open configuration file.
Error: Unable to open config file /mosquitto/config/mosquitto.conf
Error found at /mosquitto/config/mosquitto.conf:32766.
Error: Unable to open configuration file.
Error: Unable to open config file /mosquitto/config/mosquitto.conf
Error found at /mosquitto/config/mosquitto.conf:32765.
Error: Unable to open configuration file.

This is the command below.
docker run -d --name mqtt-broker --restart always -p 1883:1883 -p 9001:9001 -v /mosquitto/:/mosquitto eclipse-mosquitto

@jpwsutton
Copy link
Member

Hi, not sure if this will help you, but I recently made a docker setup for the Paho Java client, you can check out my docker file and config here: https://github.com/eclipse/paho.mqtt.java/tree/master/test/tls-testing.

The command I used to run it was:

docker run -it -p 1883:1883 -p 18883:18883 -p 18884:18884 -p 18885:18885 -p 18886:18886 -p 8080:8080 <image ID>

Obviously, my setup and use case is slightly different to yours, but hopefuly it should help you get your image to read the config file.

@PierreF
Copy link
Contributor

PierreF commented Jan 4, 2018

Does the file "/mosquitto/config/mosquitto.conf" exists ?

@PierreF PierreF added Component: mosquitto-broker Status: Blocked Another issue needs to be resolved first labels Jan 5, 2018
@Coderguy321
Copy link

Nope still error is there

@chewcw
Copy link

chewcw commented Feb 18, 2018

I encountered this error as well, I run Docker for Windows. What I did was change owner of the "/mosquitto" directory to root, then I can mount the config file, not sure why though.

@ralight
Copy link
Contributor

ralight commented Dec 8, 2018

It's been a while since there was any activity on this issue, and the docker image has changed substantially since then, so I'm going to close it. If you're still having problems, please reopen the issue and provide details.

@ralight ralight closed this as completed Dec 8, 2018
@bigcookie
Copy link

I still have this problem when mounting an external /mosquitto/config volume... Inside the container, I set the owner of the whole files/folders to mosquitto:mosquitto with RW access.
Help is still appreciated (will also look further through Google)

@bigcookie
Copy link

I managed to do the following: mounting a transfer folder and copied the original mosquitto.conf to the external volume. Also I checked the ownership. To make everything work I did the following:

  • mounting the external volumes to /mosquitto/config, /mosquitto/data and /mosquitto/log
  • changed ownership recursively to root:mosquitto for /mosquitto/data and mosquitto/log
  • changed ownership recursively to mosquitto:mosquitto for /mosquitto/config

This seem to have fixed the issue.

Suggestion:

  • If config folder is an external volume - copy a standard config file to the folder
  • make sure the permissions for the external volumes are set correctly

I installed the docker container/image in a QNAP NAS TS-653B. Not sure if the permission issue is QNAP specific...

Thanks!

@melyux
Copy link

melyux commented Apr 16, 2019

I'm still having this problem on latest.

@melyux
Copy link

melyux commented Apr 16, 2019

Ah, we're not supposed to include the /mosquitto/config line if we don't already have a configuration file ready to go. That wasn't clear from the instructions. However, the image should check if the mosquitto.conf file exists before trying to import it; if it doesn't exist, it should create a default one. As it is, one has to remove the /mosquitto/config volume mounting on the first run, and then put it in every other run.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Component: mosquitto-broker Status: Blocked Another issue needs to be resolved first
Projects
None yet
Development

No branches or pull requests

8 participants