Skip to content
Snippets Groups Projects
Commit 6c1c8f38 authored by ale's avatar ale
Browse files

Improve systemd / podman coupling

Implements the same strategy as outlined by the 'quadlet' project in
https://github.com/containers/quadlet/blob/main/docs/ContainerSetup.md
with respect to robust container shutdown.
parent ecc6357c
No related branches found
No related tags found
1 merge request!246Improve systemd / podman coupling
...@@ -120,6 +120,8 @@ exec /usr/bin/podman run \ ...@@ -120,6 +120,8 @@ exec /usr/bin/podman run \
--no-healthcheck \ --no-healthcheck \
--replace \ --replace \
--log-driver=none \ --log-driver=none \
--sdnotify=conmon \
--pull=never \
$opts \ $opts \
{% for opt in g.options %} {% for opt in g.options %}
{{ opt }} \ {{ opt }} \
...@@ -132,5 +134,6 @@ exec /usr/bin/systemd-docker --env run \ ...@@ -132,5 +134,6 @@ exec /usr/bin/systemd-docker --env run \
{% for opt in g.options %} {% for opt in g.options %}
{{ opt }} \ {{ opt }} \
{% endfor %} {% endfor %}
"$@" \
{{ item.container.image }} {{ item.container.get('args', '') }} {{ item.container.image }} {{ item.container.get('args', '') }}
{% endif %} {% endif %}
...@@ -6,14 +6,16 @@ Requires=docker.service ...@@ -6,14 +6,16 @@ Requires=docker.service
{% endif %} {% endif %}
[Service] [Service]
ExecStart=/usr/lib/float/docker/run-{{ item.service }}-{{ item.container.name }}.sh ExecStartPre=-rm -f %t/%N.cid
ExecStop=/usr/bin/{{ container_runtime }} stop --time 20 {{ item.service }}-{{ item.container.name }} ExecStart=/usr/lib/float/docker/run-{{ item.service }}-{{ item.container.name }}.sh -d --cidfile=%t/%N.cid
ExecStopPost=-/usr/bin/{{ container_runtime }} kill {{ item.service }}-{{ item.container.name }} 2>/dev/null ExecStopPost=-/usr/bin/{{ container_runtime }} rm -f -i --cidfile=%t/%N.cid
ExecStopPost=-rm -f %t/%N.cid
TimeoutStopSec=60 TimeoutStopSec=60
KillMode=control-group KillMode=mixed
Restart=always Restart=always
RestartSec=3s RestartSec=3s
Type=simple Type=notify
NotifyAccess=all
SyslogIdentifier={{ item.service }}-{{ item.container.name }} SyslogIdentifier={{ item.service }}-{{ item.container.name }}
{% if item.container.resources is defined %} {% if item.container.resources is defined %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment