From 56e1da3f3747fa0827fdc4e252fe984a97e19b25 Mon Sep 17 00:00:00 2001 From: Amanuel Elhanan <69236638+elhananjair@users.noreply.github.com> Date: Tue, 4 Feb 2025 16:18:44 +0300 Subject: [PATCH] Autostart pod on system boot (#1561) * Autostart pod on system boot * ci: fix pre-commit --------- Co-authored-by: Revant Nandgaonkar --- docs/custom-apps-podman.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/custom-apps-podman.md b/docs/custom-apps-podman.md index 58717e64..765b9b7d 100644 --- a/docs/custom-apps-podman.md +++ b/docs/custom-apps-podman.md @@ -88,6 +88,29 @@ Podman (the POD MANager) is a tool for managing containers and images, volumes m - `bench new-site myerp.net --mariadb-root-password 123456 --admin-password 123123` - `bench --site myerp.net install-app erpnext` +## Autostart pod + +- Systemd is the best option on autostart pods when the system boots. Create a unit file in either `/etc/systemd/system` [for root user] or `~/.config/systemd/user` [for non-root user] + + ```ruby + [Unit] + Description=Podman system daemon service + After=network-online.target + + [Service] + #User= + #Group= + Type=oneshot + ExecStart=podman pod start POD_NAME + + + [Install] + WantedBy=default.target + + ``` + + **Note:** Replace POD_NAME with a created pod name while creating a pod. This is a basic systemd unit file to autostart pod, but multiple options can be used, refer to the man page for [systemd](https://man7.org/linux/man-pages/man1/init.1.html). For better management of containers, [Quadlet](https://docs.podman.io/en/v4.4/markdown/podman-systemd.unit.5.html) is the best option for ease of updating and tracing issues on each container. + ## Troubleshoot - If there is a network issue while building the image, you need to remove caches and restart again