Nyobain Podman Di Debian 11

17 Januari 2022 • 2 menit untuk membaca artikel ini

Catatan ketika aku nyobain rootless podman di Debian 11

Install Podman

echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_11/ /" | sudo tee /etc/apt/sources.list.d/libcontainers.list
curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_11/Release.key" | sudo apt-key add -

sudo apt update && sudo apt install podman -y

Menambahkan docker registry dan mirror google

sudo nano /etc/containers/registries.conf

# Tambahkan ini
unqualified-search-registries = ['registry.fedoraproject.org', 'docker.io']

[[registry]]
prefix = "docker.io"
location = "docker.io"
[[registry.mirror]]
location = "mirror.gcr.io"

Enable linger untuk user yang aku pakai

Podman ini daemonless, supaya container bisa tetap jalan meskipun sesi user habis maka perlu enable linger kemudian reboot mesin

sudo loginctl enable-linger sumar
sudo systemctl reboot

Verifikasi konfigurasi podman

podman info

Nyobain build image dari Dockerfile

Isi dari Dockerfile

FROM klakegg/hugo:0.93.2-ext-alpine AS builder

COPY . /site
WORKDIR /site

RUN hugo --minify

FROM caddy:2-alpine AS webserver
LABEL maintainer="Sumarsono <[email protected]>"

COPY --from=builder /site/public /usr/share/caddy

Build:

podman build -t docker.io/sumarsono/mysite:latest .

Nyobain bikin pod, generate systemd service, dan generate k8s pod manifest

podman network create hugo-net
podman pod create --name hugo-pod --network hugo-net
podman create --name sumarsono-com --network hugo-net -p 80 --pod hugo-pod docker.io/sumarsono/mysite:latest
podman pod start hugo-pod
podman generate systemd --files --name hugo-pod
podman generate kube hugo-pod -f hugo-pod.yaml

enable systemd service yang digenerate

mkdir -p /home/sumar/.config/systemd/user
systemctl --user daemon-reload
systemctl --user enable --now pod-hugo-pod.service

Test:

[email protected]:~/podman-hugo$ podman port sumarsono-com
80/tcp -> 0.0.0.0:46319
[email protected]:~/podman-hugo$ curl -IL 0.0.0.0:46319
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 12062
Content-Type: text/html; charset=utf-8
Etag: "ragq5b9b2"
Last-Modified: Sun, 17 Apr 2022 02:41:35 GMT
Server: Caddy
Date: Sun, 17 Apr 2022 14:21:58 GMT

Sumarsono

DevOps Engineer
Kembali ke atas

Kubernetes Wireguard Pakai Wg Easy>>

<<Acme Dns Docker Compose