11/24/2021»»Wednesday

Install Hassio Docker Raspberry Pi

  1. I used to run Home Assistant on Docker too but have now moved to HASSio on Docker. For the up-to-date list of apps I run using my Docker Traefik 2 setup please refer to my GitHub Repo. In addition to the objectives listed in my original Docker media server post, I want my Traefik 2 Docker Home Server setup to offer the following.
  2. Hello fellow HA lovers. Is it possible to install HassIO with docker on the Pi B3+ on Raspian Desktop so I can use my Pi for other things? For example I want it to run HassIO and MotionEyeOS at the same time. I had this setup on an old netbook and it worked.
  3. Sudo apt-get install docker-ce docker-ce-cli containerd.io. Once Docker has finished installing we need to ensure that it will start when the system boots, so go ahead and enter this command. Systemctl enable docker. Finally we can test that Docker has been successfully installed by running the hello world command. Sudo docker run hello-world.
  1. Install Hassio Docker Raspberry Pi 4
  2. Install Hassio On Docker Raspbian
  3. Install Hassio Docker Raspberry Pin
  4. Install Hassio Docker Raspberry Pi 3
  5. Install Hassio Docker Raspberry Pi 2

Dec 29, 2019 Step 0 - install curl (as per yvanleterrible's post) before beginning. the shared folder you made for hassio is on the OMV system drive where the OMV OS resides, OR on a Samba share on a data drive? The install script is downloaded and run (I assume as root) from the share created as per steps1-3.

We need to add a few package to the default Docker image that hosts our Hass.io configuration files.

Docker only installs the packages specified in the Dockerfile that defines the image. This helps manage dependencies and keeps the image as small as possible.

However, we need some additional tools installed so we can easily modify the configuration files and version control them.

Specifically, we need vim & git. Sorry emacs fans, you are wrong here :). Vim is derived from the oldest text editors on the UNIX system and has been available on every Linux system since the beginning. Learning vim is a vital skill for any developer. Vim’s ability to chain together commands is incredibly powerful and makes editing very efficient for a power user.

Nowadays, everyone is using IDEs like VS Code, Visual Studio, IntelliJ, or even good old Notepad++. I will admit, I am mostly using VS Code both at work and at home. However, the first plugin I install is the VIM key bindings. The vim way of doing things is just too powerful and productive to give up (even if the GUI of VS Code is very helpful, it is not as powerful).

Since we will be SSH-ing in to the Raspberry Pi and it has a relatively low power processor, using vim is the most efficient and fastest way to get our work done. No shame if you want to RDP into your Raspberry Pi and install an IDE (or use SAMBA), but I prefer simple and fast.

Docker
  • Launch PuTTY and connect to your Raspberry Pi (if you need a refresher, please see my previous blog post).
  • Notice we are in the home directory of the “pi” user
  • We need to “login” to the Docker container that hosts Hass.io.
    • This command will sudo (elevate our privileges), docker (run a Docker command), exec (run a command in a Docker container), -it (start an interactive session), homeassistant (create the session on the homeassistant container, /bin/bash (open a Bash shell).

Bash is the most popular Linux shell (command interpreter) and is another vital part of your professional software development toolkit.

After starting the Bash shell, we can see that we are in the “config” directory under “root” inside the container.

If you “list” the directory, you can see the various configuration files Hass.io uses.

These are the YAML files that control your Hass.io installation. As you can see, there are lots of files (mine will have more than yours if you are just starting out).

However, if you tried to run git or vim now, you will get an error.

Again, this is because there is nothing installed in the Docker container that was not in the Dockerfile originally. So I don’t have to modify the default Dockerfile, let’s add the needed packages manually each time I login.

Apk is a package management system used by our running container. We need to use the add command to install the two packages we need (technically, we don’t need vim since vi is installed by default, but that would just be barbaric :)).

Running these 3 commands each time we login to our Raspberry Pi to edit the configuration will get tedious, so let’s cause it to happen whenever we login. Exit the bash shell you are currently in (make sure you are in the home directory for the pi user).

  • Use vim to create a new file in the home directory of the pi user.
    • A .bash_profile is a “hidden” file that is executed whenever a new bash shell is instantiated (like when you login to the Raspberry Pi).

Vim has 2 modes of operation (command & insert). This is the hardest concept to learn since this is the complete opposite of most of the WYSIWYG editors you are used to using in Windows (or emacs). Vim command mode is for moving around the editor window and manipulating text. Vim insert mode is for actually typing in text.

  • Make sure you are in insert mode (press i if you are not sure, it will say — INSERT — at the bottom of the screen). Enter the following text.
  • Press Esc, then :wq. Congratulations! You have successfully gotten over the most asked question on StackOverflow; you have successfully exited vim.

Now close PuTTY and reopen. You will see that you are no longer logged into the default pi user anymore. You have been logged into the Hass.io Docker container.

Now we need to ensure vim and git are installed whenever you login (in a future article, I will figure out how to actually modify the Dockerfile and install these packages by default, but I’m not sure how to make sure I am always up to date with the Hass.io image, so it will have to wait).

  • Create a .bashrc file in the root home directory (it will get run whenever you login to the container and install the needed packages).

Install Hassio Docker Raspberry Pi 4

Now close PuTTY and reopen. You will see that you are no longer logged into the default pi user anymore. You have been logged into the Hass.io Docker container and the 2 most important tools have been installed for you (which is the command to see where an executable is located on the filesystem).

For a long time I’ve been using Ubuntu with Docker for my HomeAssistant setup, but when trying to get that working on my Pi 4 I realized that my regular «install docker, install portainer and grab hassio» did not work. I could easily just grab the HassOS-image for RPi 4, but I want an OS with a few more options, as well as running containers outside the ones integrated with HomeAssistant. Having the 7 inch touch screen working is also nice 🙂

The process is quite simple

Assuming you have raspbian (lite or desktop – doesn’t matter), make sure everything is updated (apt upgrade ; apt upgrade -y). Then

Open this file in an editor and edit the section relevant for the RPi hardware.

Install Hassio On Docker Raspbian

The required changes are in bold

Install Hassio Docker Raspberry Pin

Save the file and run

Hassio

This will force you to type «not supported» in order to get you going.

Install Hassio Docker Raspberry Pi 3

This should hopefully do the trick and leave you with a real OS and a dockerized Hass.io on your RPi 4

Install Hassio Docker Raspberry Pi 2

Note – this method is NOT supported, and may work today, and maybe not tomorrow.

Most Viewed Posts