-
Notifications
You must be signed in to change notification settings - Fork 0
/
watchtower-compose.yml
executable file
·70 lines (66 loc) · 2.41 KB
/
watchtower-compose.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# --------------------------------------------------------------------------
# Watchtower is awesome. It allows automatically updating Docker containers,
# even itself. It's configured to run once daily at 3AM here.
# --------------------------------------------------------------------------
# quick network info:
# - subnet: 172.22.0.0/24
# - port: 2375
services:
# use docker-socket-proxy for watchtower's Docker access
watchtower-socket-proxy:
container_name: watchtower-socket-proxy
image: tecnativa/docker-socket-proxy
security_opt:
- no-new-privileges:true
restart: unless-stopped
networks: # uses the socket proxy network
watchtower_socket_network:
ipv4_address: 172.22.0.10 # assign a static IP for firewall ease
privileged: true
ports:
- 2375:2375
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- LOG_LEVEL=info
- POST=1
- CONTAINERS=1
- IMAGES=1
- NETWORKS=1
- VOLUMES=1
labels:
- "com.centurylinklabs.watchtower.monitor-only=true"
watchtower:
image: containrrr/watchtower:latest
container_name: watchtower
depends_on:
- watchtower-socket-proxy
environment:
- DOCKER_HOST=tcp://watchtower-socket-proxy:2375
- TZ=America/New_York
- WATCHTOWER_CLEANUP=true
- WATCHTOWER_INCLUDE_STOPPED=true # update stopped containers
- WATCHTOWER_REVIVE_STOPPED=false # but don't start them after
- WATCHTOWER_SCHEDULE=0 0 3 * * * # daily at 3:00:00 AM
- WATCHTOWER_NOTIFICATION_EMAIL_FROM=${GMAIL}
- WATCHTOWER_NOTIFICATION_EMAIL_TO=${GMAIL}
- WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.gmail.com
- WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT=587
- WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER=${GMAIL}
- WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=${GMAIL_PASSWORD} # https://myaccount.google.com/apppasswords
- WATCHTOWER_NOTIFICATION_EMAIL_DELAY=30
- WATCHTOWER_NOTIFICATIONS=email
networks:
watchtower_socket_network:
ipv4_address: 172.22.0.11 # assign a static IP for firewall ease
restart: unless-stopped
networks:
watchtower_socket_network:
# a custom network that all docker socket requests are routed through
name: watchtower_socket_network
driver: bridge
ipam:
config:
- subnet: "172.22.0.0/24"
gateway: "172.22.0.1"
ip_range: "172.22.0.0/24"