Considering Moving to Docker - some questions

I’m out of town this week, so I’ve got plenty of time to daydream about improving my Home Assistant setup rather than actually tinkering with it. I’m considering moving from Hassbian to Docker. I really like the idea of Docker, and especially being able to spin up dev environments on a whim. But it is a pretty new concept to me. I’m almost completely unfamiliar with Docker, so I’ve read through a lot of the forum posts here, and done some research on the google. But I still have a few questions that I’m hoping to get some help on.

  1. On Docker Hub, it looks like there are a few dockers available for HA. I assume that if I am running on a RPi3, I need to use the RPi3 version, right?
  2. How does upgrading HA on Docker work? Do you just restart the docker, and if there is an updated build available, it uses that instead? How about rolling back to a previous version?
  3. I read somewhere that Hassio add-ons would be able to be run with a Docker HA install. Is that a true statement? Presumably, that’s because Hassio add-ons are just dockers themselves, right?
  4. I’ve got a few Rpi-rf devices that are semi-critical. I am using an RF transmitter on the RPi’s GPIO to control them. I couldn’t find anything about GPIO/Docker here on the forums or in the documentation, but did some googling. Is controlling the GPIO via the HA docker as easy as exposing the ‘/dev/gpiomem’ device?
  5. Should I expect any hiccups with Z-Wave? I am using a Z-stick gen 5, via USB. but I assume exposing the appropriate USB will be sufficient. I did see a post from last year with the same question, but I think that was using Openzwave, and not the built in configurator.
  6. Any thing else I should consider before making the jump?
  7. Anything really awesome that I need to make sure to try?

If this experiment goes well, I might consider moving all my various projects over to Docker. Thanks in advance for the guidance!

I think the only way to really know how well this goes is to try it. hass.io does not work well if you need customizations but likely not impossible. Install to a new SD card, copy over your configuration and see how it goes. If there are things that are critical and you can’t get them figured out initially, it is easy to slide in your original SD card and be back where you were. If you do find things that don’t work, you will have a list of things to find solutions for. As they say “rinse and repeat” until you are ready to fully commit.

That is correct.

You download the new image. Stop the existing container and create a new container from the new image.

To downgrade, restart the old container. When you are happy, delete the old container.

This doesn’t sound plausible. hassio plugins are a thing specific to hassio.

Theoretically that sounds right, but its one of the things you should check before committing to it.

I’ve never used z-wave, but I haven’t heard of problems

If you have a working setup, I really don’t see why you would want to change.

Docker is much simplier than others.

HASS.IO Plugins are just are just other docker containers in most cases. If you run docker you would just run another docker container for the feature you desire

I can confirm this. I got up and running with Hass.io in a docker container on ubuntu server. WHen you add the add-ons from the Hass.io store they show up as additional add-on containers. Just make sure you choose the Hass.io image and not the Hass image otherwise the Hass.io tab will not show up.

I was worried initially about using samba (I configure HA via pycharm on another computer) thinking I was editing the container config files and not the files on the server that get mounted into the container.

After some investigation It wa working as planned (at least I think).

@mikeg1130 I just did the same this week. I thought I would give Docker a try from everything that I have heard here on the board. I decided to use a spare rPi so that I could tinker with it and take my time. Glad I did, there is no way, as a newbie, that I would have had a working environment in 1 day.

One thing that I did and I am pretty happy with so far is to use Docker-Compose. Basically, you just build a text file of the containers that you want to set up and execute it. To add or remove a container, just edit your file. Of course if you want to get rid of a container, you need to do some clean up and remove the image as well. To upgrade my containers, it’s really easy. just issue the following commands: docker-compose down, docker-compose pull, docker-compose up -d. That’s it!! I wish there would be more folks using docker-compose and would share their .yml file as examples.

For Z-wave, it was really simple. I have an Aotec Gen 5 as well. What I did was just to copy my z-wave files from my current setup to the new one. I also made the user part of the “dialout” group, not sure if this was overkill or not, but I plugged my stick and everything was working.

One container that I installed was Portainer, it’s pretty cool and gives you a dashboard view of all your running containers. Also there is an rPi version of HA-Dockermon. This way you can see if your containers are running from within Home Assistant.

I spent a couple of evenings trying to get Samba to work, but couldn’t figure out a way even with an armhf (rPi) image. So I just did a straight install of Samba.

Now I am really interested in the Rpi-RF as well, and I really haven’t found a solution yet, but I have to say that I haven’t looked that hard to be honest. If you find a solution, would you please share?

As I said in my first response to the post, you really need to try it, so I just did. I haven’t looked at hass.io since it was first released so I got out a Pi and installed it. I think if everything you want is there, it seems like it could work quite well. I need more control and this would not work for me. I feel like I have been bound in layers of cellophane tape. You really can’t touch the inner workings, which could be good for people who tend to break the things they touch.

Thanks everybody for the responses. All good advice/thoughts. I’m definitely going to give Docker a go, and see if it works for me and for what I am looking for. I agree about Hassio being a little too restrictive for me personally (I gave it a try when it was first released), but I do like the idea of the add-ons. Ultimately though, control and customizability is more important to me. If some of the Hassio add-ons also happen to work with a standard Docker install, that is just an added bonus. I figure moving my HA setup to Docker is a relatively low-risk way to dip my toe in the water, and if it goes well, possibly start to apply it elsewhere in my ecosystem.

I run HA in docker on my ubuntu server. It is super easy - just map a local directory into /config in the container and you’re all set. As others mentioned, if you need to revert back to the previous version, you just pull the container with that version and spin it up. Takes seconds.

I use the HUSBZB-1 stuck (which is combo z-wave and zigbee) with my docker HA. Just use the --device flag to map /dev/ttyUSB0 (or whatever your zwave stick device is into the container)

I was able to do everything without the need for any hass.io addons. I have SAMBA shared my config dir, ssh access, let’s encrypt certs, etc. there’s nothing you can’t set up yourself.

Thanks for this. I’m also trying to move to docker.

What’s blocking me at the moment are a few python scripts that I created which don’t work on the container as I’m missing apps or libraries. For example one of my scripts involves the nc (netcat) command which is not recognised. I tried to add a parameter to my run command (apt-get install netcat), but that fails. Trying to run he same install command from bash within the docker also fails.
I have a similar issue with the untangle python library.
Any suggestions?

Sorry @mikeg1130 to somewhat highjack your post, but as it’s related it might help others, hope you don’t mind

Docker containers are only intended to run one process. If you have other commands you should be doing it in another docker container, or on the host.

Thanks. I use the scripts output for some sensor.command_line sensors.
Would you have any suggestions on how I can take them out of the container while still update HA?
I know it sounds a bit like a dummy / noob question but I’m looking for guidance on where to put my efforts instead of heading down an over-complicated solution…

Thanks

How do you expose them to HA though? Say you wanted to run a command line sensor but the script to run is on the host, not in the HA docker container, how can you do this?

You have to use ssh and keypairs, or some sort of custom api.

Basically make it ssh into the host and execute stuff there

Hmmm ok thanks - will have to have a think. I can’t be the first person to want to do it so google must turn up something :slight_smile:

Hi,

I’m on Docker now too.
No problem for the devices with the good declaration.

To update my container, i hacve a container “WatchTower”.
I am on docker-compose to simplify manipulations.

WatchTower check if ther is a new image available on remote repository, and pull it.
After WatchTower restart the container with the new image automatically.

It’s possible to add a flag on the containers to avoid WatchTower to update it.

I have only one problem (integration HA - GoogleHome with google assistant component)…

ssh is certainly the standard way.

For command line sensors though, I have to admit I would try and build my own image on top of the HA image and include any extra modules needed.

I’ve seen another person use watchtower too. They heavily recommend it.

That’s actually quite simple to do if you use docker compose