Can't Remove Docker Containers

I’m not sure if this is the correct place to post this or not, but I decided to take a look at Hass.io just to poke around. I’m not new to Hass or Docker, but now that I’m done tinkering I want to remove the containers but they keep coming back.

I tried to remove the directory /usr/share/hassio, along with stopping and removing the docker containers, but eventually hassio_supervisor container restarts and then brings back the second homeassistant instance.

How do I get rid of these?

Have a look at what the script does.

https://github.com/home-assistant/hassio-build/blob/master/install/hassio_install

look into the service. :wink:

1 Like

OH MY GOD.

Thanks…

How did you remove it?

By turning off the service first?

How can I completely erase hassio (installed with docker on Ubuntu)?
It just sits there with
INFO (MainThread) [homeassistant.core] Timer:starting
I’d like to start from scratch - preferable without wiping the entire disk.

The script is saying exactly what it does. So you just have to revert that.

Simply do the following:

stop services

(thanks @IcyMidnight)

sudo systemctl stop hassio-supervisor.service
sudo systemctl stop hassio-apparmor.service

disable services

sudo systemctl disable hassio-supervisor.service
sudo systemctl disable hassio-apparmor.service

remove services

sudo rm -rf /etc/systemd/system/hassio-supervisor.service
sudo rm -rf /etc/systemd/system/hassio-apparmor.service

removing hassio folders (except the config folder)

sudo rm -rf /usr/sbin/hassio-supervisor
sudo rm -rf /usr/sbin/hassio-apparmor

Now delete the remaining docker images like you always do.
.
.
.
.

If you want to delete your Home Assistant config files,

Do the following, but be carefull! Your config is lost forever:

sudo rm -rf /usr/share/hassio/

31 Likes

Many thanks for these detailed instructions! Hopefully I will never need them …

(I did reinstall linux to fix my messed up installation, but now I am learning about docker and hassio, so hopefully I have better ways to deal with problems).

1 Like

Thanks for making it easy, tuncaya :slight_smile:

You probably also want to stop the services first:

sudo systemctl stop hassio-supervisor.service
sudo systemctl stop hassio-apparmor.service

In my case hassio-supervisor seemed to still be running and re-created the supervisor container.

2 Likes

This is interesting. A few times I have updated docker and the Hassio container does not start again… I have to manually start them in Portainer…

Yeah. The hassio setup has lead to me having a dead home assistant a few times, so I’m abandonning ship and switching to managing the container myself with a docker-compose file.

Thanks, added it

Hello. Can you share you docker compose file ?

I have a docker stack thread posted in the share your projects forum.

THANK YOU FOR THIS, I have been running into memory issues and this is making my pi 4 docker environment act a little wonky, it may NOT be hass.io, but it’s nice to finally be able to remove it and not try and remember what I set up months and months ago, it’s finally gone and I can be at peace - thank you!

1 Like

You’re welcome :wink:

I updated docker yesterday and ran into problems with Home Assistant (wouldn’t start again - even after system reboot - it seemed). So I cleared out the entire Home Assistant installation (all containers) using the instructions provided by @tuncaya above (thanks!) - stopping, disabling and removing the supervisor, then removing all containers and reinstalling. That worked and I’m back up and running, but it made me wonder:

What is the correct procedure for updating docker? I should probably have stopped the containers first? How to do that properly? Using @tuncaya’s procedure (the first two steps) of stopping and disabling the supervisor, then stopping all other containers, updating docker and then restarting the supervisor (and all containers)? Anyone?

I have never stopped HA before updating. After the update there is a docker command to restart the supervisor container which I use from ssh to the host. (Or I use Portainer as my Portainer is just a stand alone install which does restart automatically to restart the supervisor and home assistant containers). Then when HA is running, I have a script that starts all the addons as Portainer doesn’t work for them I have found.

Rebooting the host should result in everything starting normally but the host uptime is a source of pride and I don’t restart/reboot the host unless as a last resort.

This has never failed for me to get up and running again.

Ok well I have to admit that wasn’t fun.

I recently upgraded to using mariadb again.

I just did a debian update that included docker.

As per usual, I used Portainer to restart the homeassistant container. I used a bash script to restart the supervisor service as well. Then I tried to access home assistant. Nothing. Used bash to look at the logs and it was shitting itself as the mariadb addon wasn’t running. I then found Portainer is happy or HA is happy if Portainer starts all the core addons - it just won’t start the non-core community ones - or at least if you try that they stop by themselves again immediately.

Still HA won’t start and still the logger errors in the log.

I then restarted HA, supervisor, dns and audio containers (in Portainer) and HA started normally.

Yeah…

Sounds close to what I experienced yesterday. I, too, was updating Debian (sudo apt-get update && sudo apt-get upgrade) and as part of that, docker was updated. The rest is described above and was solved, but not particularly gracefully…

Oh, well, I guess the odd scare is unavoidable…