Reputation: 1036
I have been trying to make docker containers restart after reboot. I am using --restart unless-stopped
option. Container starts after reboot but I have to be logged in to my remote machine. I am running docker on my remote machine.
docker run --restart unless-stopped -d -v /var/run/docker.sock:/var/run/docker.sock --net sp-example-net -p 8080:8080 sp
Upvotes: 0
Views: 353
Reputation: 555
Docker has restart policies such as --restart=always that will handle this. This is also available in the compose.yml config file as restart: always.
Upvotes: 1