2020-03-21 13:05:43 +00:00
|
|
|
#jinja2:lstrip_blocks: True
|
|
|
|
{{ ansible_managed | comment }}
|
|
|
|
[Unit]
|
|
|
|
Description=Docker GC
|
|
|
|
Requires=docker.service network-online.target
|
|
|
|
After=docker.service network-online.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
Type=oneshot
|
|
|
|
|
|
|
|
ExecStartPre=/bin/sh -c '/usr/bin/docker ps | /bin/grep %p 1> /dev/null && /usr/bin/docker kill %p || true'
|
|
|
|
ExecStartPre=/bin/sh -c '/usr/bin/docker ps -a | /bin/grep %p 1> /dev/null && /usr/bin/docker rm %p || true'
|
|
|
|
ExecStartPre=/usr/bin/docker pull {{ dockertidy_image }}
|
|
|
|
ExecStart=/usr/bin/docker run --rm \
|
|
|
|
--name %p \
|
|
|
|
--hostname %p \
|
2020-03-22 15:47:48 +00:00
|
|
|
--env-file /etc/sysconfig/tidy \
|
2020-03-21 13:05:43 +00:00
|
|
|
--volume {{ dockertidy_docker_socket_path }}:/var/run/docker.sock \
|
|
|
|
--privileged=true \
|
2020-03-22 15:47:48 +00:00
|
|
|
--userns=host \
|
2020-03-21 13:05:43 +00:00
|
|
|
{{ dockertidy_image }} \
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|