Unused containers/images not deleted by hass.io

I’ve been messing around with hass.io for a week or so and I have noticed that created and stopped containers are building up in docker.
Also I notice that images of old versions of add-ons are retained.
Is the user expected to do housekeeping to remove unused containers and images?
Or is this something that hass.io is doing (supposed to do)?

1 Like

Can anyone confirm if it’s correct for unused containers and old images to accumulate?

You’re right, we should clean this up. We’ll address this in a future release.

In the short term I just deployed Portainer and used it to clean up the unused containers and images.
Ofc could also use command line, but portainer is small, easy to deploy, and easy to use.

3 Likes

how did you deploy portioner, if I may ask? Did you make a plugin for Hass.io?

Install portainer by per instuctions here:

Log into your hassio host.
Run command using sudo if needed:

docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer

Then go to http://:9000/

It will look like this: http://demo.portainer.io/#/auth
(password is “tryportainer”)

Thanks. It didn’t work since I ssh’ed into port 22 not port 22222.

I’ve proposed a possible fix for this here:

2 Likes

Bump… 3 year old topic :-). I was not even born then.

Via portainer Is see a lot of “UNUSED” images… is it safe to delete those? To save space?


Should these have been deleted by some auto thing?

I have deleted about 15 “addons” of which some there were about 3 or 4 versions and I did not use them anymore at all.

1 Like

Same here, sorry bumping old topic. Rather bump this than cluttering with a new topic i suppose

I deleted them successfully at that time

cool, will do it manually now. Guess we could bash command to have it clean up automatically once a week. Any thoughts?

Be careful with that. I have a cronjob doing that at night but a few times it’s blown away images that were still starting… it can create a mess.

1 Like

Your images automatically update? I do everything manually, so I guess the risk is then low?

Supervisor automatically updates.

You could prune images created more than 24 hours ago. That way new pulled images are not being touched.

docker image prune -a --filter "until=24h" -f
1 Like

Going to try that. I have been having lots of issues with supervisor updates lately (automatic ones) on the beta channel. Everytime it seems there is an automatic update I have to do a reinstall (run the HA Supervised install script again) This has happened 2 or 3 times a week for a few weeks and previously NEVER. Everything still works but the supervisor gets blown away… really weird. So I left the beta channel but still have a sensor reporting versions so I can manually update in a controlled way.

It may be a Debian component has been updated (Debian 10.10) but whatever it is it’s really annoying…

Dear @frenck, this topic is still relevant : addons built locally accumulates lots of images. It seems that previous images are not removed when the addon is updated. There are several threads on this topics and I believe it lots of people. Would it be possible to include automatic images removal upon addon update? Thanks

Example : https://github.com/alexbelgium/hassio-addons/issues/58

I’ve created a bug report here : https://github.com/home-assistant/supervisor/issues/3223

Yeah, I was just checking portainer to see which image HA was complaining about as ‘unsupported installation’ when I noticed that I had almost twice as many images as containers. So, I pruned them, and deleted over 5GB of space. Unfortunately, it did delete a couple of containers that I do not keep running constantly (tasmoadmin and check HA configuration), so I had to reinstall them. It really seems like this is something that should be, I dunno, automated?

That’s the reason of NOT using Portainer - if you don’t know what you’re doing. Accidental deletes might get you (or others) into serious troubles. Therefore:

100 % agree on this! :+1: :+1: :+1:

Had some issues during updating HA Core, ended up using ha su repair on the CLI for the first time. Noticed, after this and rebooting the host, several GB (roughly 9 GB in total) of unused images have been deleted. That’s a lot! Especially when disk space is a thing.

So is there any progress on this? Is HA OS or the Supervisor doing things on this meanwhile? I only discovered the old/former HA Core image is cleaned up pretty quickly after a successful upgrade. All the rest?