ansible/roles/watchtower_docker/templates/watchtower.service.j2

15 lines
607 B
Django/Jinja

[Unit]
Description=Watchtower with Docker
After=docker.service
Requires=docker.service
[Service]
ExecStartPre=-/usr/bin/docker rm --force {{ watchtower_container_name }}
ExecStart=/usr/bin/docker run --rm --name {{ watchtower_container_name }} --hostname {{ watchtower_hostname }} --domainname {{ watchtower_domainname }} --env-file {{ docker_volumes_dir }}/watchtower/watchtower.env -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower:{{ watchtower_version }}
ExecStop=/usr/bin/docker stop {{ watchtower_container_name }}
Restart=always
RestartSec=15s
[Install]
WantedBy=multi-user.target