Make self healing capabilities more robust (#960)

In case a container image is corrupted `docker inspect` might fail:
  # docker inspect --format='{{.Id}}' "${SUPERVISOR_IMAGE}"

  Error response from daemon: readlink /mnt/data/docker/overlay2: invalid argument

In that same state the `docker images` command still shows the images.
Since `docker inspect` returns an error SUPERVISOR_IMAGE_ID will be empty
and a simple `docker pull` will be attempted. That does not suffice to
recover from a corrupted container image.

Use `docker images` to get the image ids and make sure to delete all
image ids found by that command.

Also don't use RuntimeDirectory since it deletes the runtime directory
between the service start attempts which defeats the purpose.
This commit is contained in:
Stefan Agner
2020-11-09 13:05:54 +01:00
committed by GitHub
parent 094208492e
commit 4f28a284be
2 changed files with 6 additions and 4 deletions

View File

@@ -13,7 +13,6 @@ ConditionPathExists=/run/docker.sock
Type=simple
Restart=always
RestartSec=5s
RuntimeDirectory=supervisor
ExecStartPre=-/usr/bin/docker stop hassio_supervisor
ExecStart=/usr/sbin/hassos-supervisor
ExecStop=-/usr/bin/docker stop hassio_supervisor