Running openHAB 2 in Docker

Thanks a lot!

Hello Rich,
you are right, having a separate container for postfix is the more elegant solution.

Thank you very much :slight_smile: Now i just gonna get my Tellstick working :slight_smile:

Newbie here.
Running Ubuntu 16.04 as VM under esxi 6, ad have installed docker CE, and pulled the openhab 2.2.0 amd64 debian image.
How to I get attach my gen 5 Z stick ( which shows up as Bus 2 Device 004 ID xxxx:xxxx Sigma Designs) to the openhab docker? And for that matter, how to do so for the Telegesis Zig Bee USB stick?


Passthrough the USB devices to the VM.

They will show up as /dev/ttyUSB? where ? is a number… You will have to figure out which number is which USB device.

Use the --device option to docker run, e.g. --device=/dev/ttyUSB0 as described in the readme for the image on dockerhub and github.

1 Like

Unfortunately my motherboard, an Intel S1200kp does not allow VT-D and I cannot passthrough. But I can attach the USB device to the VM. Will that work as well?
when I do a lsusb command , it only shows up in the way I have described

Thanks for your help.

If it doesn’t show up as a file under /dev as a try file then the bindings can’t access it whether or not you are running in Docker.

Found it! its /dev/ttyACM0

How do I automatically add the z stick whilst creating the docker openhab container?

I already told you.

1 Like

Hi there,

I’m looking for on option to pre-install a certain set of bindings into my openhab2 docker container. Usually I have something like

  • Binding: Astro, Exec, Expire, MQTT, NTP
  • Misc: REST documentation
  • Persistence: MapDB, RRD4j
  • Transformation: Exec, Javascript JSONpath, Map

in a fresh install / container.

I do not like to use addons.cfg but rather prefer something like PaperUI or Karaf. Is there a script hook or something already prepared for OH2 in docker to pre-install such a list of bindings?

addons.cfg IS is the script hook or something to do this.

But now that the container properly manages upgrades, now as long as you maintain userdata outside the container all of your bindings will be there as you move from container to container, even if you change versions.

1 Like


I moved my initial post to a separate topic per @rlkoshak recommendation.

I recommend posting this as a separate tutorial so it is seen by more people and easier to find.

These entries are creating an issue when run on a MAC .

docker: Error response from daemon: Mounts denied: 
The paths /etc/timezone and /etc/localtime
are not shared from OS X and are not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.

Any known solution for this.

/etc/localtime is a link on MAC

lrwxr-xr-x  1 root  wheel  43  5 Apr  2018 /etc/localtime -> /var/db/timezone/zoneinfo/Europe/Bratislava

/etc/timezone is not existing at all.
What is the impact to ommit these 2 entries?

I don’t run on a mac. It seems likely that those files don’t exist on Mac or are put somewhere else. Those to lines set the timezone and local time inside the container to match the host.

Hi all,
I really like the docker install - it makes the install smooth.

I have a question: What about updates of openhab?
On the Raspberry PI, I logged in, made the openhab-config and performed the update. How can I do this with docker? I guess I just pull the new image - but is there a notification that a new docker file is available ?!?!

Again: Great job to all contributors!

Yes, just pull the new image and create a new container. There is no notification but the new releases are usually available within a couple of days off the initial release.

PR #213 just got merged which adds some new tags and makes use of multi-architecture manifests. It allows for Docker to download openHAB architecture specific images without having to specify the architecture in the tag.

See also the updated README:

For specific versions use:

  • openhab/openhab:<version>
  • openhab/openhab:<version>-<distribution>
  • openhab/openhab:<version>-<architecture>-<distribution>

For the latest stable release use:

  • openhab/openhab
  • openhab/openhab:latest
  • openhab/openhab:latest-<distribution>

For the latest release that has a milestone or stable maturity use:

  • openhab/openhab:milestone
  • openhab/openhab:milestone-<distribution>

For the latest snapshot release use:

  • openhab/openhab:snapshot
  • openhab/openhab:snapshot-<distribution>

What is the current state on the ping issue - we run container as root, or is there another option to have the network binding discover devices?

When trying the network binding, I have to first manually add a device, which will state “ONLINE” even if it is offline (in this case, an iphone).

Why is arp_state disabled? When exec’ing into the container with user openhab, the following command works perfectly reliably, showing the iphone as responding to packets when turned on, and not responding when turned off:

arping -I eth0 -c 2
ON => 60 bytes from 98:ca:33:bc:42:13 ( index=0 time=56.558 msec
OFF => Timeout

So how do I make the binding actually use arping, as it is installed by default in the container and seems to work just fine when directly calling the command? Additional question: how can I troubleshoot myself? I’ve put the “” bundle into TRACE but it’s not showing me anything that looks wrong.


  • running container as root fixes the DHCP permission as expected
  • icmp_state still fails for pinging (I want to see these errors in the logs :() but at least we can already conclude that the Java ping is incorrectly saying it successfully pings a device which doesn’t exist…

Update 2:
Ok I’m going down this rabbit hole until I got it cleared out. So I installed ping in my container with

apt-get install iputils-ping

All good, ping now just seems to work:

First remark: what’s the issue here - why aren’t we installing ping in the Docker container?
Weirdly enough, the device is still showing as ONLINE. When I run the exact same ping command the binding uses in my container ad-hoc, I get:

ping -w 5 -c 1
PING ( 56(84) bytes of data.
From icmp_seq=1 Destination Host Unreachable

Clearly, interpretable as offline. So I looked at the code of the binding:

if (line.contains("host unreachable") || line.contains("timed out")
                        || line.contains("could not find host")) {
                    return false;

Is this what I think it is? Just a case sensitivity issue? I still haven’t managed to set up a way to debug this issue, could someone confirm?

So currently the open issues are:

  • why is arp_state disabled for my binding inside my container?
  • why is a device that is shut off showing as ONLINE when using either the Java ping or the unix native ping?

I really have nothing to offer in terms of answers or advice. I can confirm that arping was merged into the container in June. I don’t know why ping wasn’t added at that time as it was discussed but by default ping is almost never installed in a Docker container so that would explain why it is absent.

It does look like part of the problem could be a case problem, but at this point you know a whole lot more about the code than I do.

You should consider opening an issue and even better submit a PR to the openhab-docker project to include ping.