Supposed I have a Docker container that I want to run, then I can call
$ docker run ...
and everything is fine. Is there a built-in way to run a container in a way that it will be restarted automatically, if the system crashes and reboots?
If so, is this also available in Docker Compose?
Yes, docker has restart policies such as docker run --restart=always
that will handle this. This is also available in the compose.yml config file as restart: always
.