Restart Docker Containers with systemd

Hello together,

when restarting the machine, which happends for sure from time to time it is kinda tedious to restart the containers manually.

Is there some way and practical example to put all the restart into one self-scriped like docker.restart.service with systemd?

Thanks and kind regards,

Do you know portainer?
Maybe this is what you are looking for :slight_smile:

You likely need to enable the docker daemon to start:

sudo systemctl enable docker

check:

sudo systemctl status docker

And as @anon35253067 said you need to have a restart policy for your container in its docker run command, i.e. --restart unless-stopped

1 Like