8장. Working with pods
Containers are the smallest unit that you can manage with Podman, Skopeo and Buildah container tools. A Podman pod is a group of one or more containers. The Pod concept was introduced by Kubernetes. Podman pods are similar to the Kubernetes definition. Pods are the smallest compute units that you can create, deploy, and manage in OpenShift or Kubernetes environments. Every Podman pod includes an infra container. This container holds the namespaces associated with the pod and allows Podman to connect other containers to the pod. It allows you to start and stop containers within the pod and the pod will stay running. The default infra container on the registry.access.redhat.com/ubi10/pause image.
8.1. Creating pods 링크 복사링크가 클립보드에 복사되었습니다!
You can create a pod with one container.
Prerequisites
-
The
container-toolsmeta-package is installed.
Procedure
Create an empty pod:
$ podman pod create --name mypod 223df6b390b4ea87a090a4b5207f7b9b003187a6960bd37631ae9bc12c433aff The pod is in the initial state Created.The pod is in the initial state Created.
Optional: List all pods:
$ podman pod ps POD ID NAME STATUS CREATED # OF CONTAINERS INFRA ID 223df6b390b4 mypod Created Less than a second ago 1 3afdcd93de3eNotice that the pod has one container in it.
Optional: List all pods and containers associated with them:
$ podman ps -a --pod CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES POD 3afdcd93de3e registry.access.redhat.com/ubi10/pause Less than a second ago Created 223df6b390b4-infra 223df6b390b4You can see that the pod ID from
podman pscommand matches the pod ID in thepodman pod pscommand. The default infra container is based on theregistry.access.redhat.com/ubi10/pauseimage.Run a container named
myubiin the existing pod namedmypod:$ podman run -dt --name myubi --pod mypod registry.access.redhat.com/ubi10/ubi /bin/bash 5df5c48fea87860cf75822ceab8370548b04c78be9fc156570949013863ccf71Optional: List all pods:
$ podman pod ps POD ID NAME STATUS CREATED # OF CONTAINERS INFRA ID 223df6b390b4 mypod Running Less than a second ago 2 3afdcd93de3eYou can see that the pod has two containers in it.
Optional: List all pods and containers associated with them:
$ podman ps -a --pod CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES POD 5df5c48fea87 registry.access.redhat.com/ubi10/ubi:latest /bin/bash Less than a second ago Up Less than a second ago myubi 223df6b390b4 3afdcd93de3e registry.access.redhat.com/ubi10/pause Less than a second ago Up Less than a second ago 223df6b390b4-infra 223df6b390b4