Hi, new to openhab but not to docker. I noticed that when following the tutorial and using the --user switch the container fails to start with the following error:
- echo 'Starting with openhab user id: 1008 and group id: 1008’
Starting with openhab user id: 1008 and group id: 1008
- id -u openhab
Create group openhab with id 1008
- echo ‘Create group openhab with id 1008’
- groupadd -g 1008 openhab
groupadd: Permission denied.
groupadd: cannot lock /etc/group; try again later.
The container started with when only using the environment variable switches (-e USER_ID & -e GROUP_ID) and it also created the files on the host with the correct user id. Did I miss anything obvious? I couldn’t find any further mentions of the issue on the forum.
Thank you. Would you please file an issue on the openhab-docs repo. When the tutorial was written I don’t think the container yet supported the user and group environment variables. Or, if you think the container should support the --user flag file an issue with openhab-docker.
I have already opened a pull request with those changes.
While I’ve got someone who knows their way around the OH Docker image…
Does @Benjy’s suggestion on this thread make sense?
It has been on my list to try my hand at implementing this but I’m nowhere near a Docker expert and am not sure what the side effects of the above would be.
But if we can come up with a way to upgrade without all but wiping out the userdata folder that would all kinds of awesomeness.
I have a question how to proceed if I want to test a new binding in a docker container environment. To be more specific, I have a running stable docker container based on the final OH2 2.2 image and I am happy with that. Now I want to test the beta version of a binding which is currently only on GitHub. So I would clone the docker image and clone my personal user data directories (conf, addons, … etc.) and have then a clone of my existing docker environment.
My question is: How do I proceed now to replace an existing binding of a docker image with the beta version from GitHub?
Would I simply put the new bindings file into the addons folder?
Would OH2 be smart enough to see that there is a newer version of the binding and activate the one from the addons folder instead of the one coming in the container?
Or do I need to deinstall/remove/deconfigure the existing binding before OH2 detects the new binding in the addons folder?
I would kindly appreciate your tipps and tricks.
And I guess the best way is to do this via Paper UI oder HABmin, right?
Depends on how you install the add-ons in the first place. If you use the UIs then yes. If you use the karaf console you should uninstall them from there. If you use addons.cfg you should remove the binding from there.
It is about the avmfritz binding. I have configured through the addons.cfg file. The point where I am hanging is: In the addon.cfg file I only give the name of the binding and not its location:
# A comma-separated list of bindings to install (e.g. "sonos,knx,zwave") binding = avmfritz,km1001,weather1,weatherunderground,zwave
How do I tell OH2 not to use the binding coming with the distribution but to use instead the one given in the addons folder?
EDIT: My addons folder is normally empty. Actually I do not know where OH2 gets the addons from as I thought they should be there Anyway … I assume that I would put the new beta version of the binding into the addons folder and now I need to understand how to tell OH2 to use this instead off the official one.
Or can it be that the beta version has a different name???
You remove it from addons.cfg, wait for it to be uninstalled, then add the new jar to the addons folder.
Does " … to be uninstalled, …" mean, that it does not appear anymore in the “bundle:list” command in the karaf console?
Sorry, for being stupid
yes. you should also see logs saying that it is being removed.
Thanks!!! Will do!
I would like to get some advice. I run openHAB on RPi2, and a second on a Banana Pro on an SSD drive. I only recently i came across docker and started to familiarize me with it.
I have a two questions. Using the tutorial in this tread i was able to get openhab running in a container with the config, addons and log files on the host file system. That works perfectly. Rich, thank you very much for this tutorial!
But my environment consists of Z-Wave and Sonoff devices.
My first question regards the z-wave config in a docker container. I use a Aeon Gen5 USB z-wave stick. Does anyone know if the USB/ttyACM0 device on the host will be available in the docker container? (I have not tried it yet, because i have only one stick and that is in use…)
My second question regards the use on mqtt (for Sonoff). The via this tut installed openHAB does not includes eg mosquitto.
Is it possible to add mosquitto to the openHAB container, either by installing it by hand in the openhab container and then save this as a new container? Or make use of docker-compose file and make a new container including the missing parts?
Or is it better to make a separate container for mosquitto (and for InfluxDb and for Grafana)? According to the docker directions one should create a separate container for every process that one uses.
But for me, it would be nice when i can backup one container with everything i use in openhab, this including InfluxDb, Grafana and mosquitto.
I am looking forward to your suggestions.
Btw, which containers for these products do you use for openhab? On the hub.docker.com i find multiple containers…
You have to make it available.
--device=/dev/ttyUSB0 as an argument to docker run will make that device available in the container. See the command in “Running the container as a service” in the OP.
Correct. Mosquitto is a separate service which needs to be installed and configured separately. I use the official Mosquitto Image from Dockerhub.
This is counter to the purpose of Docker and considered a very bad practice. Each service should have its own container.
However, if you want to get into the business of building your own Docker images, there is nothing stopping you from creating such an image yourself.
You CAN write a docker-compose file that starts OH and Mosquitto in two separate containers which is not only supported but the expected way one would use docker-compose. I don’t use docker-compose so can’t help with the specifics. But docker-compose is used to start up and manage one or more docker containers, not build new Docker images.
You should not be backing up containers. You should mount volumes into your container to keep the data that needs to be backed up and/or persisted. Containers are ephemeral. They are designed to be replacable and you need to treat all the files inside the container as temporary. Anything that needs to stick around even when a new container is created needs to be saves in a mounted volume. This is why you must mount your conf and userdata folder into the container. Otherwise there would be no way to upgrade the container because upgrading the image means changing the image and creating a new container…
I always use the official images. So for Mosquitto I use eclipses’ image. For InfluxDB I use InfluxDB’s image. For Grafana I use Grafana’s image. There is only one image I build myself (Calibre) and that is because there isn’t an official image and the existing images either didn’t work for me or worked in ways I didn’t like.
Hi Rich, Thank you for answering my questions.
I will forget about my idea to combine multiple services in one container. I have the eclipse-mosquitto now running as a separate container next to the openhab container.
Currently planing my installation. I prefer docker, but I am not sure if everything will work.
I would for example like to shutdown my PC with Openhab. In another post they said that you need to install samba to do that. But in docker container there is no samba.
I just don’t want to limit myself. So this is a hard decision.
Any help? What won’t work with official docker container?
This makes no sense at all. Can you point me to that post?
Samba has nothing to do with one’s ability to shutdown the PC.
However, the whole point of a Docker Container is to isolate the container from the host machine. I would be shocked if you can call shutdown or reboot the host from inside the container. That would break the whole reason containers exist.
Just tried it. It won’t work. The shutdown and reboot commands cannot talk to the init daemon from inside the container. And I’d still argue that even if you could, you shouldn’t.
I’d also question the wisdom for OH to directly reboot the machine it is running on directly, but lots of people do it.
Generally, you will have to run as root and use host networking to use Network binding’s DHCP listen. You cannot use arping or system pings from the Network bindings, though there is an open issue to add that which I hope to work on this weekend. The exec binding and executeCommandLine will be pretty useless to you as there isn’t much installed in the Docker Image, is it should be, you want Containers to have as little installed as feasible. I’m sure there are other things that cannot be used as well.
However, given the nature of the question, I’m going to guess you don’t know much about Linux yet. Given that I’m going to strongly recommend using openHABian. You don’t have to be running on a RPi to use it. See the Manual Installation instructions.