openhab / openhab-docker

Repository for building Docker containers for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
209 stars 128 forks source link

Why is this so difficult?! #343

Closed Erik262 closed 3 years ago

Erik262 commented 3 years ago

Hi folks,

I'm sitting for hours and now I'm very frustrated, because I can't get mqtt running in this docker container. I switched from ioBroker to openHab. I can't understand why it is so complicated to get this working! Why is this not installed as default?? SmartHome assistant without mqtt is unimaginable.

There are many tutorials to get mqtt running with/in openhabian but not with the original openHab one. I can't do this, because I don't have a raspberry but a NAS where I'm actually trying to get this running.

So I tried to install the packages I need manually through the console, but I have to do this every time when the container crashes/restarts etc. Is there a way or a different way to solve this??

This is what I want to run after the container started:

apt update apt install nano apt install mosquitto mosquitto -p 1887

wborn commented 3 years ago

When going the Docker route the best practices are to run each process in its own container. So you want to create an instance of the mosquito container (https://hub.docker.com/_/eclipse-mosquitto) and not install it in the openHAB container. Containers are supposed to be light weight and only contain and run that what is absolutely necessary for a single process. That way they remain small, startup quickly and are less vulnerable to security issues. I.e. containers should not be used like VMs. So you might want to read up on how to use Docker in general and ask further openHAB related support questions on community.openhab.org .

philippwaller commented 3 years ago

Hi Erik262,

running multiple daemons inside a docker container is a bit tricky and overall not recommended for several reasons (more information here). Instead, you should start a separate Docker container for each service (Openhab, MQTT Broker, Database, etc.) and connect them via a host network.

Update: wborn was faster 🥇

Erik262 commented 3 years ago

O.K. so thanks for helping and giving me the information about docker and that I have to run everything separately