What is Home Assistant Container? What is needed and how to install one? How to properly update a Home Assistant Container installation after new Home Assistant release? I will try my best to address all these questions right now, starting with what is Home Assistant Container?

What is Home Assistant Container?

Home Assistant Container is one of the official installation types and It is simply a Home Assistant running in your own container environment. That means if you managed to install Home Assistant using Docker software or some similar containerization software you will have a Home Assistant Container installation.

In general, there are 4 official and supported ways to get Home Assistant. All of the four installation types have some pros and cons and there is no right or wrong way here. I will not talk about the other 3 possible and supported Home Assistant installation methods in this article. I will just say that the Home Assistant Container is the second most popular type of installation according to the analytics.home-assistant.io website.

Active Installations of the different Home Assistant Installation types. Home Assistant container is the second most popular one
Active Installations of the different Home Assistant Installation types. Home Assistant Container is the second most popular one

However, if you want to understand all of the pros and cons of the different Home Assistant Installation types I can suggest to register for my Webinar, which is exactly about this topic. After seeing my webinar you will know about the strengths and weaknesses of all four ways.

The webinar is completely free and this is the link to it – https://automatelike.pro/webinar

As summary, Home Assistant Container is a Home Assistant installed using Docker or other similar containerisation software. It is also one of the 4 official methods to get Home Assistant. 

Home Assistant Container Prerequisites

Strangely enough, having Docker up & running is one of the prerequisites to start Home Assistant Container using Docker 😉

The other prerequisite is to have a folder where the Home Assistant configuration files will be stored. That means I just have to create one empty folder somewhere on my computer and to remember the full path to that folder.

That is it, noting unusual here.

It is also recommended to subscribe for my newsletter where you will receive articles like this one on a weekly basis. I won’t spam and you can unsubscribe at any time from the received messages. Of course, this part is optional (newsletter subscribing) and you can freely skip it. Which will make me sad… 🙁

How to install Home Assistant Container?

Next big question is: How to install Home Assistant Container?

I will try to answer this with a real life demo. I will use Docker which is a free and probably the most popular containerisation software available at the moment.

Docker can be installed on all major Operating Systems.

Docker can be started almost anywhere
Docker can be started almost anywhere

For Windows & macOS, the Docker installation is very easy and there is nothing special. You just have to download the installation package from the official Docker website (docker.com) and to install that package on your computer as usual.

There are some minor differences if you are using Linux. It all depends of your Linux distribution, but I believe the best approach will be to type in Google something like: “how to install Docker on Ubuntu”, or CentOS, or whatever your Linux distro is.  

Anyways, I’m using Mac OS and below you can see how the Docker looks like after it is installed and it is up and running. I won’t show you the Docker installation itself, because as I said there is nothing complicated there.

Docker Desktop Dashboard in macOS
Docker Desktop Dashboard in macOS

Next thing, that I have to do is to execute one big and scary command that will do everything for me and I just have to sit back and relax. How cheeky is that? 

BTW All the credits for the used commands goes to Home Assistant documentation – https://www.home-assistant.io/installation/linux#install-home-assistant-container

docker run -d \
  --name homeassistant \
  --privileged \
  --restart=unless-stopped \
  -e TZ=MY_TIME_ZONE \
  -v /PATH_TO_YOUR_CONFIG:/config \
  --network=host \
  ghcr.io/home-assistant/home-assistant:stable

The above command should be executed in Terminal or Command Prompt and it should work in most of the cases (Linux & Windows), but for the macOS a slight modification is needed. Instead of --network=host parameter, I had to add a port mapping -p 8123:8123. So, the full command looks like that:

docker run -d \
  --name homeassistant \
  --privileged \
  --restart=unless-stopped \
  -e TZ=MY_TIME_ZONE \
  -v /PATH_TO_YOUR_CONFIG:/config \
  -p 8123:8123 \
 ghcr.io/home-assistant/home-assistant:stable

In any of the cases above you should change the following:

This below is my final command that I used on my macOS:

docker run -d \
  --name homeassistant \
  --privileged \
  --restart=unless-stopped \
  -e TZ=Europe/Sofia \
  -v /Users/kirilpeyanski/haconfig:/config \
  -p 8123:8123 \
 ghcr.io/home-assistant/home-assistant:stable

The above Docker run command will download the latest stable Home Assistant image from Internet and it will start it. I will have to do the heavy lifting, which is to open the Home Assistant web interface. I’m kidding here it is just the opposite.

To open the Home Assistant I just have to type the http://IP_OF_MY_DEVICE_WHERE_DOCKER_IS:8123 (as example: http://10.0.0.115:8123) in a new browser.

Alternatively, the following address can be used – http://homeassistant.local:8123

There is no guarantee that the above hostname based address will work, as this depends of the router and the router configuration.

No matter if IP or Hostnme is used, as end result the Home Assistant welcome screen should be seen.

Home Assistant Container Welcome Screen
Home Assistant Container Welcome Screen

How to upgrade Home Assistant Container Properly?

As you may know there is one major Home Assistant release in the beginning of every month and multiple minor releases during that period.

The above procedure is about installing the latest stable Home Assistant Container version, but next month there will be newer latest stable Home Assistant version and some of us may want to upgrade.

Here is how I can update my Home Assistant Container installation properly using several commands in Terminal/Command prompt:.

  • Pull the latest stable Home Assistant image with the command below:
docker pull ghcr.io/home-assistant/home-assistant:stable

Quick Tip: Check the name of the container either with the command: docker container ls -a
or from the Docker Dashboard and if it is different than homeassistant – replace it in the commands bellow:

  • Stop the existing Home Assistant Container.
docker stop homeassistant
  • Remove the existing Home Assistant Container
docker rm homeassistant
  • Execute the Docker run command the same way as you did during the initial installation of Home Assistant Container
docker run -d \
  --name homeassistant \
  --privileged \
  --restart=unless-stopped \
  -e TZ=MY_TIME_ZONE \
  -v /PATH_TO_YOUR_CONFIG:/config \
  --network=host \
  ghcr.io/home-assistant/home-assistant:stable

If everything is fine with the above commands, you should have an updated to the latest stable release Home Assistant Container installation. Enjoy!

Outro

If some of the terms and abbreviations that I’m using are not so clear for you, don’t worry I’m here to help. I’ve put together a Smart Home Glossary and I want to give it to you for free. You can download that from my other website https://automatelike.pro/glossary 

Thank you for reading. I’m Kiril and I’m done writing. Bye!


2 Comments

Jesper · 28/09/2022 at 9:52 pm

So, with this is installation, backups are not possible, right?

    KIril Peyanski · 28/09/2022 at 11:13 pm

    Oh, they are possible. You can backup & restore as usual!

Leave a Reply

Avatar placeholder

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.