Changing docker startup options without re-creating container
With command line
If the container is running and you want to modify it’s settings:
docker update --restart=<policy> <name>
If the container is not running and you want to start it:
docker container run --restart=<policy> <name>
Policy can be any of those:
- no
- always
- unless-stopped
- on-failure
With docker-compose
It can be set in docker-compose file like that:
version: "3"
services:
app:
image: linkace/linkace:simple
restart: unless-stopped