Skip to content
Snippets Groups Projects

Traefik podman 3.x + systemd unit file example

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Alexander Wellbrock

    The following is a generated and modified systemd unit file from the podman generate systemd command for reference.

    snippetfile1.txt 1.07 KiB
    # container-traefik.service
    # autogenerated by Podman 3.3.1
    # Wed Sep 15 08:58:59 CEST 2021
    
    [Unit]
    Description=Podman container-traefik.service
    Documentation=man:podman-generate-systemd(1)
    Wants=network-online.target
    After=network-online.target
    RequiresMountsFor=%t/containers
    
    [Service]
    Environment=PODMAN_SYSTEMD_UNIT=%n
    Restart=on-failure
    TimeoutStopSec=70
    ExecStartPre=/bin/rm -f %t/%n.ctr-id
    ExecStart=/usr/bin/podman run \
        --cidfile=%t/%n.ctr-id \
        --sdnotify=conmon \
        --cgroups=no-conmon \
        --rm \
        --replace \
        --security-opt label=disable \
        --label-file /var/srv/traefik/label \
        --network proxy \
        --network-alias=traefik \
        --name traefik \
        -v /var/srv/traefik/traefik.toml:/etc/traefik/traefik.toml:ro \
        -v /var/run/docker.sock:/var/run/docker.sock \
        -p 80:80 \
        -p 8080:8080 \
        -d \
        docker.io/library/traefik:latest
    ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
    ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
    Type=notify
    NotifyAccess=all
    
    [Install]
    WantedBy=multi-user.target default.target
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment