Skip to content

Commit 576a71e

Browse files
maxxerklardotsh
authored andcommitted
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/
1 parent 65f33b5 commit 576a71e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

docker-compose.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ version: "2"
22
services:
33
database:
44
image: "zulip/zulip-postgresql:10"
5+
restart: unless-stopped
56
environment:
67
POSTGRES_DB: "zulip"
78
POSTGRES_USER: "zulip"
@@ -13,6 +14,7 @@ services:
1314
- "/opt/docker/zulip/postgresql/data:/var/lib/postgresql/data:rw"
1415
memcached:
1516
image: "memcached:alpine"
17+
restart: unless-stopped
1618
command:
1719
- "sh"
1820
- "-euc"
@@ -25,17 +27,17 @@ services:
2527
SASL_CONF_PATH: "/home/memcache/memcached.conf"
2628
MEMCACHED_SASL_PWDB: "/home/memcache/memcached-sasl-db"
2729
MEMCACHED_PASSWORD: "REPLACE_WITH_SECURE_MEMCACHED_PASSWORD"
28-
restart: always
2930
rabbitmq:
3031
image: "rabbitmq:3.7.7"
31-
restart: always
32+
restart: unless-stopped
3233
environment:
3334
RABBITMQ_DEFAULT_USER: "zulip"
3435
RABBITMQ_DEFAULT_PASS: "REPLACE_WITH_SECURE_RABBITMQ_PASSWORD"
3536
volumes:
3637
- "/opt/docker/zulip/rabbitmq:/var/lib/rabbitmq:rw"
3738
redis:
3839
image: "redis:alpine"
40+
restart: unless-stopped
3941
command:
4042
- "sh"
4143
- "-euc"
@@ -48,6 +50,7 @@ services:
4850
- "/opt/docker/zulip/redis:/data:rw"
4951
zulip:
5052
image: "zulip/docker-zulip:5.7-0"
53+
restart: unless-stopped
5154
build:
5255
context: .
5356
args:

0 commit comments

Comments
 (0)