Why Switch to Podman? A Hands‑On Guide to Installing, Running, and Managing Containers
This article introduces Podman, explains how to install it on CentOS, demonstrates pulling and running Nginx, MySQL, and a SpringBoot application, compares Podman with Docker, and shows how to manage containers visually with Cockpit, providing a practical alternative to Docker.
Podman Overview
Podman is an open‑source, daemon‑less container engine developed by Red Hat. It runs OCI containers, offers a Docker‑compatible CLI, and is pre‑installed on CentOS 8 (CentOS 7 requires manual installation).
Installation
On CentOS 7 install with
yum -y install podmanand start the service with
systemctl start podman.
Basic Usage
Examples of pulling images and running containers:
Pull Nginx:
<code>podman pull nginx:1.10</code>Run Nginx with privileged mode and volume mounts:
<code>podman run -p 80:80 --name nginx \
--privileged \
-v /mydata/nginx/html:/usr/share/nginx/html \
-v /mydata/nginx/logs:/var/log/nginx \
-d nginx:1.10</code>Run MySQL similarly:
<code>podman run -p 3306:3306 --name mysql \
--privileged \
-v /mydata/mysql/log:/var/log/mysql \
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=root \
-d mysql:5.7</code>Enter the MySQL container and view databases:
<code># Enter container
podman exec -it mysql /bin/bash
# Login to MySQL
mysql -proot -uroot
# Show databases
show databases;</code>Running a SpringBoot Application
Pull the image from Docker Hub and run it, noting that Podman does not support the
--linkoption, so the MySQL service must be accessed via its IP address.
<code>podman run -p 8088:8088 --name mall-tiny-boot \
--privileged \
-e spring.datasource.url='jdbc:mysql://192.168.3.106:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai' \
-v /etc/localtime:/etc/localtime \
-v /mydata/app/mall-tiny/logs:/var/logs \
-d macrodocker/mall-tiny-boot:latest</code>After the container starts, the Swagger UI is reachable at
http://192.168.3.106:8088/swagger-ui/.
Visual Management with Cockpit
Cockpit, included in CentOS 8, provides a web UI that can manage Podman containers, view logs, restart, stop, delete containers, and download images.
Podman vs Docker
Key differences:
Podman runs without a daemon and can operate under the invoking user; Docker relies on a root‑owned daemon.
Podman supports rootless containers; Docker’s daemon runs as root.
Podman uses external tools (e.g., Buildah) for image building; Docker builds images directly.
Podman follows a modular design with separate utilities; Docker provides an all‑in‑one CLI.
Most Docker commands work with Podman, and a
podman-dockershim can translate Docker commands to Podman.
Conclusion
Podman offers a Docker‑compatible experience while eliminating the daemon, making it suitable for environments that require rootless operation or modular tooling. Existing Docker users can adopt Podman with minimal changes, but switching is optional depending on project needs.
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.