docker-compose-restart-policy-always¶
The restart policy always is a configuration option in docker-compose used to define the restart behavior of a service container.^[600-developer__docker__docker-compose__docker-compouse-02.md]
Definition¶
When this policy is applied, the container is configured to always restart regardless of the exit condition.^[600-developer__docker__docker-compose__docker-compouse-02.md] This means that if the container stops—whether it crashes or is stopped manually—the Docker daemon will automatically restart it.
Usage¶
The policy is set using the restart key in the docker-compose.yml file with the value always.^[600-developer__docker__docker-compose__docker-compouse-02.md]
version: "3"
services:
db:
image: mysql:5.7
restart: always
Related Concepts¶
- [[Docker]]
- DevOps
Sources¶
^[600-developer__docker__docker-compose__docker-compouse-02.md]