Protip: How to get shell in actual homeassistant (or addon) container when using Hassio

This took a surpising amount of digging to find… I needed to debug a command_line switch that wasn’t working as expected in so I wanted a shell on the actual environment. It’s pretty simple once you actually figure out how…

  1. Shut down your pi and put the SD Card in your computer.
  2. Create a file in the resinos-boot partition called authorized_keys and put your ssh public key in it.
  3. Put the SD Card back in your pi and start it up.
  4. Run this SSH command:
    ssh -t root@hassio -p 22222 “docker exec -it \$(docker ps -f name=homeassistant -q) bash”

If you’re on windows first putty to root@hassio port 22222 then run
docker exec -it $(docker ps -f name=homeassistant -q) bash

You can substitute the name of addons where you put name=homeassistant to get into them instead. To get a full list of containers you can just run “docker ps”

UPDATE: This post was originally written with respect to resinOS hassio, newer hassio now uses HassOS. The following proceedure should still get you the same thing.

  1. Follow the instructions here to add your ssh key
  2. ssh root@hassio -p 22222
  3. At the hassio > prompt run “login”
  4. At the shell prompt you can run docker commands such as: “docker exec -it $(docker ps -f name=homeassistant -q) bash” which will get you a shell inside the homeassistant container.

Thanks for this, I’m trying to solve some mDNS issues and this really helps


Thanks, that really helped with a firmware update of a deCONZ Raspbee. You need to access docker to do it.

1 Like

With what credentials you must login? I tried the credentials from Home Assistant, but failed to login.

Alternative that worked for me:

  • Install Portainer addon
  • Find the container in Portainer and run a root shell there.

How to do that? I’m running on HassOS. There is no container running. I guess it only runs containers on demand.

Home Assistant (formerly always has running containers, at least the supervisor container and the Home Assistant container are always running.

Thanks for your reply. Now I know that “supervisor”, “homeassistant”, “addon” and “dns” containers runs hidden.

Thank you! I’ve been hours wondering why a script fails…what a nightmare it is that this isn’t documented anywhere else!

Can anyone provide a bit more detail on doing this via Portainer? I’m not seeing any active containers in Portainer, just a single endpoint with a certain number of images (18 for me) and some networks (4 for me).

Where should I go from here to be able to run docker commands? How do you even run a root shell from a certain container?

Edit: nevermind, figured out my problem. I didn’t even need to mess around with Portainer. I was using the official SSH and Terminal addon, which doesn’t have support for docker commands. I installed the community SSH and Web Terminal addon, and docker commands worked on the Web Interface out of the box.


Have a look at the portainer addon documentation. HA containers are hidden (for obvious and good reasons), if people know what they´re doing they can make them visible).

I think I have a similar problem. Need to share a file with a container (Deconz plugin) since this is needed in order to make a Zigbee device update.
Where you able to access the container file system?

  1. Remove the containers from the hidden list - as described in the Portainer addon documentation
  2. Go to the container (only tested homeassistant)
  3. Start console, done

It’s so easy - and quite dangerous. There’s a reason why those HA containers are hidden. People not knowing what they do could quite easily damage (parts of) their system.

1 Like

I didn’t need to use Portainer. Install the COMMUNITY SSH & Web Terminal add-on (the one made by Frenk), then use docker container ls to list docker containers. Then I accessed the required container (for me it was InfluxDB) using docker exec -it 21332546_influxdb influx -username XXX -password XXX replacing 21332546_influxdb with container ID. Not sure what you would replace influx with in your situation.


Thanks to your suggestion I have been able to solve my problem.
I also used the community SSH addon to access the container.

Well that´s pretty much what Portainer does - only on a webpage not on a CLI.

What would be the command for accessing the homeassistant docker container?

Thank you very march for SSH and Web Terminal suggestion. Now I’m able to install my own container to hassio rpi using docker command line!

Thanks. SSH community is great for running Docker CLI

Big thx for this info with the community ssh, the only bad thing on haos was that the other containers were not accessable.

I understand why it is the default setting but as advanced linux user it was depressing until now. :wink:

Really great!!!