Docker command not creating new container its just running...?


Why does this happen when i run this it just starts mqtt, but no container is running? How do i get it in it’s own permanent container so that home-assistant can talk to it?
24%20PM

this is the command, do i take out run -it?

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

The -it is redirecting I/O to your terminal. You’re probably not wanting that, so if you leave it out the container will be running in the background. You might want to look at the documentation here because you probably want --restart=always and maybe some other options too.

1 Like

Adding the -d will also start in the background.

Or you can detach with commands crtl+p ctrl+q. (Only in docker, not in docker-compose)

Then create a password file inside the container with the mosquitto_passwd command. You can mount that file where you have your config as well. If you want to use password of course.

1 Like

here is my docker run command for eclipse-mosquitto that works:

sudo docker run -d --name=eclipse-mosquitto --restart=unless-stopped -p 1883:1883 -p 9001:9001 -v /home/finity/docker/mqtt/config/mosquitto.conf:/mosquitto/config/mosquitto.conf -v /home/finity/docker/mqtt/config/passwd:/mosquitto/config/passwd -v /home/finity/docker/mqtt/data:/mosquitto/data -v /home/finity/docker/mqtt/log:/mosquitto/log -e PGID=1000 -e PUID=1000 -e UMASK_SET=000 eclipse-mosquitto

I got it to run, but now home-assistant is throwing a bunch of errors, i have it in the docker server as home-assistant, do i need to anything in the config?

Those particular errors are usually the important information.

There is nothing needed to get it to run the first time.