Skip to content

simplify podman systemd generate - remove cidfile #13236

@grooverdan

Description

@grooverdan

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind feature

Description

podman systemd generate creates an ExecStartPre to remove a cidfile, and ExecStart line that include a cid file, and an ExecStop that uses it, and an ExecStopPost that removes it.

For a Type=notify with the MAINPID of the conman pushed (per comment #12778 (comment) / #9642) all of these usages of cidfile are not needed.

The Type=notify with an accurately communicated pid, and conman acting on all signals to shutdown the container means all the cidfile related directives can be removed.

Steps to reproduce the issue:

  1. bin/podman generate systemd --name --new --template {container}

Describe the results you received:

$ bin/podman generate systemd --name --new --template quizzical_satoshi
# [email protected]
# autogenerated by Podman 4.0.0-dev
# Tue Feb 15 10:04:40 AEDT 2022

[Unit]
Description=Podman container-quizzical_satoshi.service for %I
Documentation=man:podman-generate-systemd(1)
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n-%i
Restart=on-failure
TimeoutStopSec=70
ExecStartPre=/bin/rm -f %t/%n.ctr-id
ExecStart=/home/dan/repos/podman/bin/podman run --name=container-quizzical_satoshi-%i --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon -d -ti fedora:35
ExecStop=/home/dan/repos/podman/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
ExecStopPost=/home/dan/repos/podman/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all

[Install]
WantedBy=default.target

Describe the results you expected:

$ bin/podman generate systemd --name --new --template quizzical_satoshi
# [email protected]
# autogenerated by Podman 4.0.0-dev
# Tue Feb 15 10:04:40 AEDT 2022

[Unit]
Description=Podman container-quizzical_satoshi.service for %I
Documentation=man:podman-generate-systemd(1)
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n-%i
Restart=on-failure
TimeoutStopSec=70
ExecStart=/home/dan/repos/podman/bin/podman run --name=container-quizzical_satoshi-%i --cgroups=no-conmon --rm --sdnotify=conmon -d -ti fedora:35
Type=notify
NotifyAccess=all

[Install]
WantedBy=default.target

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

$ bin/podman version
Client:       Podman Engine
Version:      4.0.0-dev
API Version:  4.0.0-dev
Go Version:   go1.16.13
Git Commit:   5977fd509582d6dc8727ce8f8a78011888a1dc17-dirty
Built:        Tue Feb 15 10:03:25 2022
OS/Arch:      linux/amd64

Package info (e.g. output of rpm -q podman or apt list podman):

built from source (today)

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)

Yes

Additional environment details (AWS, VirtualBox, physical, etc.):

Discovered investigating @eriksjolund's good use of systemd, podman and socket activation examples eriksjolund/mariadb-podman-socket-activation#1

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.locked - please file new issue/PRAssist humans wanting to comment on an old issue or PR with locked comments.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions