arrow_back
Back

Docker Compose: services, networks, volumes, and compose.yml

Andrew Dorokhov Andrew Dorokhov schedule 1 min read
menu_book Table of Contents

docker-compose.yml

Be careful to not use special characters ($) or if it’s needed than to escape it like $$.

Restart option

no is the default restart policy, and it does not restart a container under any circumstance.

restart: "no"
restart: always
restart: on-failure
restart: unless-stopped

When always is specified, the container always restarts.

unless-stopped always restarts a container, except when the container is stopped (manually or otherwise).

The on-failure policy restarts a container if the exit code indicates an on-failure error. Optionally, limit the number of times the Docker daemon attempts to restart the container using the :max-retries option.

restart: on-failure:10

open_in_new Documentation page .

code

Need Help with Development?

Happy to help — reach out via the contacts or go straight to my Upwork profile.

work View Upwork Profile arrow_forward
Next Article

Docker reverse proxy: Traefik, Nginx, routing, and TLS

arrow_forward