OH3 on Docker on Windows 10 WSL

I’m taking a run at running OH3 in a Docker container on a Windows 10 machine running WSL2/Ubuntu.

OH starts and the interface comes up, but right off the bat there’s a slew of warnings in the logs e.g.:

2021-03-19 08:28:11.813 [WARN ] [rg.apache.aries.spifly.BaseActivator] - Could not read SPI metadata from jar:bundleresource://46.fwk1744189907/lib/woodstox-core.jar!/META-INF/services/javax.xml.stream.XMLEventFactory

java.io.IOException: No such file or directory

I wonder if this is a show-stopper of if I can safely disregard this for now. My next step would be to try to get a new Z-Stick connected.

Please indulge me and don’t make assumptions about my knowledge of Ubuntu/Linux, which is less than minimal.

This may be really not helpful but I just wanted to say that my own WSL2 experiences were short and all in all very disappointing… There were just so many things that did not work out of the box that I decided that it was just not worth putting more effort into it (for now).

I’ll second Thomas’s assessment. Docker on Windows is likely not going to work for you, particularly if you need to pass hardware to it. the last I looked that’s not possible so you won’t be able to get your Z-Stick connected. If you want to do this and keep Windows as the base OS, you’ll either want to install OH on Windows or run in a Linux VM. Your likelihood of success running OH in Docker on Windows is low.

Thanks guys. I was afraid that would be the case. I was really hopeful I could run a suite of containers for all my HA, database, utility, and home-built .net core apps on the same host and use traefik to simplify hostnames and ports, and ssl. My stubborn instance on sticking with Windows is going to be a problem. Having said that, I have a D411 Synology with docker I could use for OH3; maybe I’ll give that a whirl.

If using VMs on Windows VirtualBox is a pretty good solution using bridged NICS so the VM gets its own outside network address.

Thanks @Bruce_Osborne, I’m going that route.

1 Like

As a follow-up @Bruce_Osborne, VirtualBox turned out to be a dud. It allowed me to create the ubuntu VM and install OH just fine, but could not restart the VM after the host restarted. After a bunch of troubleshooting, I discovered that apparently VirtualBox doesn’t work and play well with WSL. WSL2 breaks VirtualBox 6.1 · Issue #798 · MicrosoftDocs/WSL · GitHub

It’s all very disappointing. I bought a decent box to win Win10/WSL expecting to run Windows and Linux containers to modernize/manage my whole HA/utility stack. It appears that utopia still isn’t in the cards, at least for a Windows die-hard like me.

OK I have not user VirtualBox with WSL2. WSL2 is basically a subset of Microsoft’s Hyper-V virtual machine server so I guess that makes sense. If you have Windows 10 Professional Hyper-V may be an option.

VMWare Workstation Player is free for personal use. Player doesn’t have the nice GUI for creating VMs but it’s not too hard to manage it. Install Ubuntu in VMware Workstation – Linux Hint

I’ve no idea if it has problems with WSL2 or not.

Qemu is another hypervisor that works on Windows and it’s open source. But it’s really low level stuff with configuring and usage.

I’ve seen conflicting reports that KVM works with WSL2.

Other options could be to run Linux as your base OS and run Windows in a VM.

I think Hyper-V and any other hypervisor cannot coexist on a Windows machine, WSL1 was not a hypervisor but WSL2 is a subset of Hyper-V.

KVM is a little different in that it works at the Linux kernel level as a kernel module instead of under the Linux kernel. And since WSL2 is supposed to be running a full kernel theoretically it should work.

I think that qemu also creates the VMs differently and at a higher level so it might not interfear with Hyper-V.

And of course, if one doesn’t need WSL2 or Hyper-V for anything else, they can be disabled which should allow all that to work too.

I’m not too far from having messed with WSL2 and hypervisors but in January I replaced my work machine with a Mac because my old Windows machine did not age very well. So I don’t have a place to experiment with this stuff on Windows any more.

At home I was a long time users of VirtualBox but now do all my VM stuff on ESXi. Had I to do it over again I would have chosen KVM. But even with my Ansible playbooks it’ll take a few days of solid work to rebuild everything on KVM and I don’t want to deal with that amount of down time.

One current restriction with WSL2 is that a WSL2 OS cannot access USB Serial devices.

That does make things difficult. I forgot that was mentioned above too and one reason docker won’t work.

1 Like

I have actually tested that on Windows 10 Home. My IH VM is on a server running Hyper-V. The serial Z-Wave stick is recognized by the OS and the resulting serial port is mapped to the OH VM.

Yep, that (among other blockers) is why I gave up on trying to host OH in a container on that machine.

OH3 looks downright sexy; I can’t wait to work out a reliable infrastructure for it, abandon my OH2 luggage, and start fresh with lessons learned. I appreciate you and @rlkoshak not needling me for being such a dotnetohpile. I need this Win/WSL docker host for other projects, and hoped to lay OH onto it as well.

I’m not adverse at this point to setting up a cheap box to run (Ubuntu?) despite my linuphobia. I know a lot of people have had success on a pi, but it never struck me as “serious” enough to entrust my home to. Maybe that’s yet another phobia I just need to get over.

Assuming I was willing to drop a couple of hundred bucks on a dedicated box for OH, with the goal of getting it set up and never (or rarely) touching it again except across the wire through the OH UI/API, where would you point me? A pi? A mini? Something else?

Thanks,
Andy

1 Like

My work machine is a Mac and I don’t like it. “It just works” is a myth in my experience. In general I’ve no allegiance to any OS and all are welcome. I’m probably most familiar with Linux these days but that’s as much because a lot of the tools I like don’t run well on FreeBSD.

I love my Chromebooks though.

An RPi with openHABian can get you up and running pretty quickly with minimal (not none) Linux knowledge and skills. But if you are willing to spend more you might look at a NUC. That would be way over powered than an RPi but less fiddly when it comes to dealing with the fact the RPi is running off an SD card. IIRC some NUC kits come with an SSD, or you might have a spare one which can make things easy. If not, factor that into the cost. And they can run Windows (though for that matter there is a stripped down version of Windows that can run on an RPi too) so you don’t necessarily need to abandon Windows. You might just have to abandon running OH in Docker on that one machine but can put everything else on your big machine.

RPis are used in industrial contexts. It is definitely “serious” enough to run your home automation. Except for the SD cards, I’ve found them to be really solid machines even under harsh conditions. But SD cards are terrible. They wear out over time and power outages to the machine can corrupt the file system. Though it’s also super easy to swap in a cloned one in an emergency.

But I would never recommend just setting any machine up and not at least periodically logging in and upgrading the OS and related packages. So no matter what you choose, you’ll want to plan for at least that.

Ultimately it’s all what you are comfortable with and/or what you want to learn.

No kidding. I put my wife and daughter on Macs on the flawed theory that it would lower my support burden. I was a big Mac guy decades ago but it seems unrecognizable now.

FWIW, my biases aren’t so much about OS than development stack. I’m just comfortable in dotnet, and that water tends to find its level on Windows. But lots of dotnet folks I work with work are on Macs.

Thanks for the perspectives.

Just as a follow-up, I ran into some issues trying to use VirtualBox, but Hyper-V hosted an Unbuntu environment for OH just fine (even if it’s a but more of a resource pig than OH in a Docker container). Still have a long way to go actually using OH3, but at least everything is installed and running. Thanks for the thoughtful responses.

I an Virtualbox with a bridged NIC for a month or two quite reliably. I had Windows drivers for my Z-Wave stick and mapped the resulting COM port to the VM.

Circling back to this: Are you saying you have a VM under Hyper-V and you are able to connect your Z-Wave stick? I’ve had zero luck with that so far. It’s an Ubuntu VM.