Podman — Pods¶
A pod groups one or more containers together so they can be managed as a single unit — the same concept Kubernetes uses for its pods. Podman can create and run pods locally, including rootless pods.
Creating a rootless pod¶
Create a pod:
Create a pod and publish it through a single port — this maps host port 8081 to port 80 inside the pod, and names the pod p3-web:
Add a container to that pod:
YAML file basics¶
Podman pods can also be described declaratively in a YAML manifest, similar in spirit to a Kubernetes pod spec.
apiVersion identifies the API schema version being used:
kind declares what kind of object this manifest describes — here, a pod:
metadata (with a name field) gives the pod its identity:
spec describes what should actually run inside the pod, starting with its containers:
Each container entry needs a name, and an image to pull (here, from Docker Hub):
ports exposes a container port on the host — here, nginx listens on port 80 inside the pod, and that's exposed on host port 8080: