-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-stack.yml
41 lines (39 loc) · 1.18 KB
/
docker-stack.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
version: '3.4'
services:
long_lived:
image: nginx:alpine
ports:
- "8000:80"
deploy:
replicas: 2
healthcheck:
test: "wget -O - -q http://localhost/"
interval: 1s
timeout: 2s
retries: 10
short_lived:
image: alpine:3.6
command: "sh -c 'touch /tmp/healthy && sleep 20 && exit 0'"
deploy:
replicas: 2
labels:
docker-php.service.lifecycle: shortlived
restart_policy:
condition: none
healthcheck:
test: "cat /tmp/healthy"
interval: 1s
timeout: 2s
retries: 10
long_lived_flapping:
image: alpine:3.6
environment:
- NO_FAILURES_AFTER_TIMESTAMP
command: "sh -c 'if [ $$(date +%s) -lt $$NO_FAILURES_AFTER_TIMESTAMP ] ; then sleep 3; echo ho no...; exit 128; else echo no failure mode; touch /tmp/healthy; sleep 86400; echo byebye; exit 0; fi'"
deploy:
replicas: 2
healthcheck:
test: "cat /tmp/healthy"
interval: 1s
timeout: 2s
retries: 10