podman ❤️ systemd

Use systemd to start podman containers.

Container information:

Double check the name of the container using the podman ps command.  Use the container name as the unit filename and as the commands for ExecStart & ExecStop  in the unit file.

CONTAINER ID   IMAGE                            COMMAND                  CREATED          STATUS             PORTS                    NAMES
411a6c6be7d8   docker.io/library/test-server:latest   docker-entrypoint.s...   40 minutes ago   Up 30 minutes ago>6379/tcp   <name>

Make systemd unit file:

Description=Podman container description here
ExecStart=/usr/bin/podman start -a <name>
ExecStop=/usr/bin/podman stop -t 10 <name>

Enable service:

sudo systemctl enable <name>.service
sudo systemctl start <name>.service

See Also: https://podman.io/blogs/2018/09/13/systemd.html

Subscribe to Independent Computing

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.