docker-compose: Default all services to restart unless-stopped.

`restart:` was previously inconsistently provided to service definitions
(only memcached and rabbitmq) and at that, the restart policy was
`always`. `always` can lead to surprising behavior where restarts of the
docker daemon will resurrect explicitly-stopped containers, whereas
`unless-stopped` will leave explicitly-stopped containers stopped.

Set all services in the docker-compose file to `restart:
unless-stopped`.

Further reading: https://linuxhandbook.com/docker-restart-policy/
This commit is contained in:
Lorenzo Milesi
2022-11-17 21:04:08 +01:00
committed by Josh Klar
parent 65f33b502f
commit 576a71e1b8

View File

@@ -2,6 +2,7 @@ version: "2"
services:
database:
image: "zulip/zulip-postgresql:10"
restart: unless-stopped
environment:
POSTGRES_DB: "zulip"
POSTGRES_USER: "zulip"
@@ -13,6 +14,7 @@ services:
- "/opt/docker/zulip/postgresql/data:/var/lib/postgresql/data:rw"
memcached:
image: "memcached:alpine"
restart: unless-stopped
command:
- "sh"
- "-euc"
@@ -25,10 +27,9 @@ services:
SASL_CONF_PATH: "/home/memcache/memcached.conf"
MEMCACHED_SASL_PWDB: "/home/memcache/memcached-sasl-db"
MEMCACHED_PASSWORD: "REPLACE_WITH_SECURE_MEMCACHED_PASSWORD"
restart: always
rabbitmq:
image: "rabbitmq:3.7.7"
restart: always
restart: unless-stopped
environment:
RABBITMQ_DEFAULT_USER: "zulip"
RABBITMQ_DEFAULT_PASS: "REPLACE_WITH_SECURE_RABBITMQ_PASSWORD"
@@ -36,6 +37,7 @@ services:
- "/opt/docker/zulip/rabbitmq:/var/lib/rabbitmq:rw"
redis:
image: "redis:alpine"
restart: unless-stopped
command:
- "sh"
- "-euc"
@@ -48,6 +50,7 @@ services:
- "/opt/docker/zulip/redis:/data:rw"
zulip:
image: "zulip/docker-zulip:5.7-0"
restart: unless-stopped
build:
context: .
args: