[Unit] Description=Podman Compose based service After=network.target # Nginx is not started with podman compose # We start it on the host network, so we can access the ports exposed on localhost # host network is buggy on older versions of podman-compose, versions we still want to support... [Service] Type=exec # If started incorrectly: stop it first (ie when started without systemd, systemd will know something is started # and will not do anything when start is called on a unit that already is running) ExecStartPre=-/usr/bin/podman stop -t 10 nginx ExecStartPre=-/usr/bin/podman rm nginx ExecStart=/usr/bin/podman run --name nginx --network host -v {{ homedir }}/nginx.conf:/etc/nginx/nginx.conf:ro -v {{ config.certificatefile | expandpath }}:/etc/nginx/ssl.cert:ro -v {{ config.keyfile | expandpath }}:/etc/nginx/ssl.key:ro -v /etc/timezone:/etc/timezone:ro -v /etc/localtime:/etc/localtime:ro docker.io/library/nginx ExecStop=-/usr/bin/podman stop -t 10 nginx ExecStop=-/usr/bin/podman rm nginx Restart=always WorkingDirectory={{ homedir }} [Install] WantedBy=default.target