A Practical Introduction to Linux Containers with Podman
Aug 02, 2025 am 12:07 AMPodman is a container management tool that requires no daemons, supports rootless running and is compatible with Docker commands. It is suitable for Linux users who pursue security and simplicity. 1. Simple installation, mainstream distributions can be installed directly through the package manager; 2. Common commands such as podman run, ps, pull, build, etc. are consistent with Docker, without learning costs; 3. Support rootless containers to improve security and avoid permission problems; 4. Pods can be created to share network and storage, simulate Kubernetes environment; 5. Systemd service files can be generated to realize the container booting and self-start. In summary, Podman is a lightweight, safe and efficient Docker alternative, especially suitable for local development and CI/CD scenarios, and is worth adopting in daily work.
Linux containers have become a go-to solution for lightweight, portable application deployment — and while Docker is well-known, Podman is emerging as a powerful, daemonless alternative that fits seamlessly into modern workflows. If you're looking to get started with containers on Linux without the overhead of a daemon or tight coupling to Docker, Podman is a solid choice.

Here's a practical guide to help you start using Podman for everyday container tasks.
What Is Podman and Why Use It?
Podman (short for Pod Manager ) is a container management tool developed by Red Hat that provides a Docker-compatible CLI experience — but without requiring a background daemon. Unlike Docker, which runs a central dockerd
process, Podman runs containers directly as your user, improving security and simplifying system integration.

Key advantages:
- No daemon needed : Reduces attack surface and avoids permission issues.
- Rootless containers : Run containers as a regular user, enhancing security.
- Drop-in Docker replacement : Most
docker
commands work withpodman
(eg,podman run
,podman build
). - Pod support : Like Kubernetes, you can group containers into pods for better orchestration.
If you're on a modern Linux distro (Fedora, RHEL, Ubuntu 20.04 , etc.), Podman is likely already available or easily installable.

# On Fedora/RHEL sudo dnf install podman # On Ubuntu/Debian sudo apt install podman
Basic Podman Commands (Docker Users Will Feel at Home)
Podman mimics Docker's CLI, so if you've used Docker before, you'll recognize most commands.
1. Run a Container
podman run hello-world
This downloads and runs the hello-world
image. No sudo
needed — it just works.
2. List Running Containers
podman ps
Like Docker, this shows active containers. Add -a
to include stopped ones.
3. Pull an Image
podman pull ubuntu:22.04
Fetches the image from a registry (defaults to Docker Hub).
4. Start an Interactive Session
podman run -it ubuntu:22.04 /bin/bash
Launches an Ubuntu container with an interactive shell.
5. Run in Detached Mode
podman run -d -p 8080:80 nginx
Starts Nginx in the background and maps port 8080 on the host.
You can verify it's running:
podman ps
Managing Images and Containers
Podman gives you full control over your container lifecycle.
List and Remove Images
podman images podman rmi <image-id>
Stop and Remove Containers
podman stop <container-id> podman rm <container-id>
You can chain commands:
podman rm $(podman ps -aq) # Remove all stopped containers
Save and Share Containers
Want to export a container as an image?
podman commit <container-id> my-custom-app podman save my-custom-app | gzip > my-app.tar.gz
Later, load it on another machine:
gunzip -c my-app.tar.gz | podman load
Build Container Images with Podman
Podman supports building images from Dockerfiles using podman build
.
Example:
# Dockerfile FROM alpine RUN apk add --no-cache curl CMD ["curl", "https://httpbin.org/json"]
Build it:
podman build -t my-curl-app .
Run it:
podman run my-curl-app
? Tip: Use
--format docker
if you want Docker-compatible image formatting:podman build --format docker -t myapp .
Rootless Containers and Security
One of Podman's biggest strengths is rootless operation . By default, containers run under your user account, not as root.
This means:
- No need to add users to a
docker
group. - Better isolation and reduced privilege escalation risks.
- Works well in restricted environments (eg, shared servers, CI pipelines).
Under the hood, Podman uses user namespaces and slirp4netns
for networking when running rootless. For most use cases, this "just works" — but if you hit a network issue, check that slirp4netns
is installed.
Working with Pods (Like Mini Kubernetes)
Podman supports pods , which let you group containers that share the same network and storage — just like in Kubernetes.
Create a pod:
podman pod create --name myweb -p 8080:80
Run a container inside it:
podman run -d --pod myweb nginx
Add another container (eg, a logging sidecar):
podman run -d --pod myweb alpine watch 'date >> /shared/log.txt'
Now both containers share the same network namespace — they can talk via localhost
.
Clean up:
podman pod rm myweb -f
This is great for testing multi-container apps locally without Docker Compose or Kubernetes.
Integrating with Systemd (Bonus: Auto-start Containers)
Podman can generate systemd unit files to manage containers as services.
Example: Auto-start an Nginx container at boot.
Run the container:
podman run -d --name nginx-server -p 80:80 nginx
Generate a systemd service:
podman generate systemd --name nginx-server --files --new
This creates a
.service
file in/tmp
or current directory.Move it to systemd:
mv container-nginx-server.service ~/.config/systemd/user/
Enable and start:
systemctl --user enable container-nginx-server.service systemctl --user start container-nginx-server.service
Now your container starts automatically when you log in (or boot, with lingering enabled).
Bottom Line
Podman is a mature, secure, and practical tool for managing containers on Linux. Whether you're a developer, sysadmin, or DevOps engineer, it's worth trying — especially if you value simplicity, security, and compatibility.
You can use it as a direct Docker replacement with no learning curve, benefit from rootless containers , and even simulate Kubernetes-style pods for local development.
Give it a spin next time you reach for Docker. You might not look back.
Basically that's all— no magic, just better defaults.
The above is the detailed content of A Practical Introduction to Linux Containers with Podman. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

LXD is described as the next-generation container and virtual machine manager that offers an immersive for Linux systems running inside containers or as virtual machines. It provides images for an inordinate number of Linux distributions with support

The key steps for creating a self-signed SSL certificate are as follows: 1. Generate the private key, use the command opensslgenrsa-outselfsigned.key2048 to generate a 2048-bit RSA private key file, optional parameter -aes256 to achieve password protection; 2. Create a certificate request (CSR), run opensslreq-new-keyselfsigned.key-outselfsigned.csr and fill in the relevant information, especially the "CommonName" field; 3. Generate the certificate by self-signed, and use opensslx509-req-days365-inselfsigned.csr-signk

Firefox browser is the default browser for most modern Linux distributions such as Ubuntu, Mint, and Fedora. Initially, its performance might be impressive, however, with the passage of time, you might notice that your browser is not as fast and resp

When encountering DNS problems, first check the /etc/resolv.conf file to see if the correct nameserver is configured; secondly, you can manually add public DNS such as 8.8.8.8 for testing; then use nslookup and dig commands to verify whether DNS resolution is normal. If these tools are not installed, you can first install the dnsutils or bind-utils package; then check the systemd-resolved service status and configuration file /etc/systemd/resolved.conf, and set DNS and FallbackDNS as needed and restart the service; finally check the network interface status and firewall rules, confirm that port 53 is not

If you find that the server is running slowly or the memory usage is too high, you should check the cause before operating. First, you need to check the system resource usage, use top, htop, free-h, iostat, ss-antp and other commands to check CPU, memory, disk I/O and network connections; secondly, analyze specific process problems, and track the behavior of high-occupancy processes through tools such as ps, jstack, strace; then check logs and monitoring data, view OOM records, exception requests, slow queries and other clues; finally, targeted processing is carried out based on common reasons such as memory leaks, connection pool exhaustion, cache failure storms, and timing task conflicts, optimize code logic, set up a timeout retry mechanism, add current limit fuses, and regularly pressure measurement and evaluation resources.

As a system administrator, you may find yourself (today or in the future) working in an environment where Windows and Linux coexist. It is no secret that some big companies prefer (or have to) run some of their production services in Windows boxes an

Frankly speaking, I cannot recall the last time I used a PC with a CD/DVD drive. This is thanks to the ever-evolving tech industry which has seen optical disks replaced by USB drives and other smaller and compact storage media that offer more storage
![Installation and Review of Q4OS Linux [Lightweight Distro]](https://img.php.cn/upload/article/001/242/473/175150507396452.jpg?x-oss-process=image/resize,m_fill,h_207,w_330)
Q4OS is a new Linux distribution that’s based on Debian; a common base that’s shared with other distributions like Ubuntu and Linux Mint. It’s aimed at users who just want a simple, stable, easy to use Linux operating system that they can convenientl
