Cara Membuat Rootless Container Podman Bisa Dikelola Sebagai Service
Prasyarat Podman Panduan Sebagai contoh kita akan membuat container nginx pada non-root user bernama student Buat direktori untuk menyimpan konten mkdir website echo '<h1>Halo Dunia!</h1>' > website/index.html Buat container nginx podman run -d --name websiteku -p 8080:80 -v ~/website:/usr/share/nginx/html:Z nginx Verifikasi container podman ps curl localhost:8080 Contoh output [student@podman-host ~]$ podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 109ed419f29e docker.io/library/nginx:latest nginx -g daemon o... About a minute ago Up About a minute ago 0.0.0.0:8080->80/tcp websiteku [student@podman-host ~]$ curl localhost:8080 <h1>Halo Dunia!</h1> Buat direktori untuk menyimpan service systemd container mkdir -p ~/.config/systemd/user/ Generate service systemd cd ~/.config/systemd/user/ podman generate systemd --name websiteku --files --new Hentikan dan hapus container yang telah dibuat podman stop websiteku podman rm websiteku Jalankan dan enable service container-websiteku systemctl --user daemon-reload systemctl --user enable --now container-websiteku Aktifkan linger pada user student # Jalankan sebagai user student loginctl enable-linger Catatan! linger berfungsi agar systemd service user yang telah dienable dapat berjalan saat system boot ...