Podman

Podman, an Open Source Docker replacement.

Podman Desktop, an Open Source Docker Desktop replacement, letting you avoid paying for a Docker Desktop subscription.

Why?

Need an easy way to run containers locally.

Alternatives

  • Docker
  • Lima
  • Rancher Desktop

Prerequisites

  • Brew

How

brew install podman
brew install podman-desktop

Create and run Kubernetes manifests with Podman

Start from “podman run” or from a docker-compose file.

k8s/docker-compose-whoami.yaml

version: '3.9'

services:
  whoami:
    image: traefik/whoami
    command:
       # It tells whoami to start listening on 2001 instead of 80
       - --port=2001
       - --name=iamfoo
    ports:
      - "8900:2001"
compose -f docker-compose-whoami.yaml up -d
curl localhost:8900  
podman generate kube k8s-whoami-1 > whoami-k8s.yaml

whoami-k8s.yaml

apiVersion: v1
kind: Pod
metadata:
  annotations:
    io.podman.annotations.ulimit: nofile=524288:524288,nproc=7248:7248
  creationTimestamp: "2023-07-10T14:27:06Z"
  labels:
    app: k8s-whoami-1-pod
  name: k8s-whoami-1-pod
spec:
  containers:
  - args:
    - --port=2001
    - --name=iamfoo
    image: docker.io/traefik/whoami:latest
    name: k8s-whoami-1
    ports:
    - containerPort: 2001
      hostPort: 8900

compose -f docker-compose-whoami.yaml down

podman play kube whoami-k8s.yaml
curl localhost:8900

podman stop k8s-whoami-1-pod-k8s-whoami-1
podman start k8s-whoami-1-pod-k8s-whoami-1
Docker  K8s  Podman