Cannot restart Exited containers after a power outage


#1

How can u restart the containers present in docker after a power outage.
After the power outage the containers are not running. When i check docker with:

pi@BrewPi-server:~ $ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2d2d8251e5e9 brewpi/brewpi-raspbian “/entrypoint.sh /wat…” 4 days ago Exited (255) 24 hours ago 0.0.0.0:80-81->80-81/tcp brewpi
a6f19a40f20b portainer/portainer “/portainer -H unix:…” 5 days ago Exited (255) 24 hours ago 0.0.0.0:9000->9000/tcp portainer

I can see they have the status Exited. When I try to start these containers i get the response:

pi@BrewPi-server:~ $ docker start portainer
Error response from daemon: container “a6f19a40f20b6ef7faeb6291f4b9524bba4e5c3f216bda30e48e74b40379d6b6”: already exists
Error: failed to start containers: portainer

What can I do to start these containers. And what to do to restart them automatically after a power outage.


#2

Creating them with --restart always should handle that for you.
This is part of the commands given on the wiki.

Maybe the containers are somehow broken due to the outage? couldn’t find much about exit code 255 that seemed relevant. If you run docker stop, docker rm, then recreate the containers you should still have all your settings and data.


#3

I’ve had this happen myself. I had to delete and recreate portrainer. I could then fix BrewPi from within Portainer.


#4

Have it happen every reboot/shut-down. Possibly a docker bug.

Kill, restart, pause etc does not work. Just rm and recreate.

From wiki. What, if any, brew/controller settings are not stored outside the container?

I plan to just add simple start script to rm/run brewpi/portainer containers every time os comes up. Sucky work around but will do the job.

Once up and completed full hardware environment will be no concern as whole fridge. controllers, routers all on UPS.

If you do this, you will lose any changes you made inside the container. Only the BrewPi settings and data that are stored outside of the container are kept.


#5

If you make changes customizations to the code, this is not persisted. But any changes you make from the web UI should be persisted.

Are you running raspbian lite?


#6

yes - Latest rasp lite.


#7

Just following up. Problem sorted. Docker bug, fixed in latest docker 18.05.
Also installed and configured docker-compose for portainer only, will think about adding brewpi.