Podman Tutorial
Overview
Podman is an open-source container management tool designed to be a drop-in replacement for Docker. It allows you to manage containers and pods without requiring a daemon.
Installing Podman
On Linux
To install Podman on a Linux system, use the package manager specific to your distribution:
Debian/Ubuntu
Fedora
CentOS/RHEL
On macOS
To install Podman on macOS, you can use Homebrew:
On Windows
To install Podman on Windows, you can use the Podman Windows installer available from the Podman releases page.
Basic Podman Commands
1. podman --version
Check the installed Podman version.
Example
2. podman pull
Download a container image from a registry.
Example
3. podman images
List all available container images on your system.
Example
4. podman rmi
Remove a container image.
Example
5. podman run
Run a container from an image.
Example
6. podman ps
List running containers.
Example
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
abcd1234efgh nginx "nginx -g 'daemon of…" 10 minutes ago Up 10 minutes 0.0.0.0:80->80/tcp quizzical_hermann
7. podman stop
Stop a running container.
Example
8. podman rm
Remove a stopped container.
Example
9. podman exec
Execute a command inside a running container.
Example
Working with Pods
A Pod is a group of one or more containers that share the same network namespace.
1. podman pod create
Create a new pod.
Example
2. podman pod ps
List all pods.
Example
3. podman pod stop
Stop a running pod.
Example
4. podman pod rm
Remove a pod.
Example
Example YAML Files
Container Definition
Podman does not use YAML files natively for container definitions. Instead, you use podman run
commands or create Podman-compatible configuration files manually.
Pod Definition
Podman supports Kubernetes YAML files for defining pods.
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
- name: my-container
image: nginx
ports:
- containerPort: 80
To apply the YAML configuration, use:
Summary
This tutorial introduces fundamental Podman commands and concepts. Podman provides a powerful and flexible way to manage containers and pods without a central daemon. For more detailed information, refer to the official Podman documentation.