beginner-friendly tutorial for podman

 Hi, Are you want learn Podman? here’s a step-by-step beginner-friendly tutorial to get you started.

1️⃣ Install Podman

On macOS (via Homebrew)

brew install podman

To initialize Podman:

podman machine init podman machine start

On Linux (Ubuntu/Debian)

sudo apt update sudo apt install podman -y

On Windows (via WSL)

Use WSL 2 and install Podman using:

winget install podman

2️⃣ Verify Installation

Check if Podman is installed correctly:

podman version

Check system details:

podman info

3️⃣ Running Your First Container

Pull and run an Ubuntu container:

podman run -it ubuntu bash
  • -it: Interactive mode (lets you use the terminal inside the container).
  • ubuntu: Image name.
  • bash: Starts a bash shell.

To exit the container:

exit

4️⃣ List Running Containers

podman ps   - To see active containers:
podman ps -a -To see all containers (including stopped ones):

5️⃣ Stopping and Removing Containers

Find the container ID:        podman ps -a

Stop a container:            podman stop <container-id>

Remove a container:        podman rm <container-id>

To remove all stopped containers:        podman rm -a


6️⃣ Pulling and Running Docker Images

Podman can run Docker images:

podman pull nginx podman run -d -p 8080:80 nginx

This runs Nginx in the background (-d) and maps port 8080 to 80.

Check if it's running:

podman ps

Open http://localhost:8080 in your browser.

To stop and remove the container:

podman stop <container-id> podman rm <container-id>

7️⃣ Using Podman as a Docker Alternative

Podman provides a Docker-compatible CLI:

alias docker=podman

Now you can use docker commands as usual.


8️⃣ Running Containers as a Pod

Unlike Docker, Podman supports Kubernetes-style pods. Create a pod:

podman pod create --name mypod -p 8080:80

Run a container inside the pod:

podman run -d --pod mypod nginx

Check running pods:

podman pod ps

To stop and remove the pod:

podman pod stop mypod podman pod rm mypod

9️⃣ Podman Compose (For Multi-Container Apps)

Podman has podman-compose (alternative to Docker Compose). Install:

pip install podman-compose

Create a podman-compose.yml file:

version: '3' services: web: image: nginx ports: - "8080:80"

Run:

podman-compose up -d

🔟 Building Images with Podman

Like Docker, Podman can build images using Containerfile (or Dockerfile): 1️⃣ Create a Containerfile:

FROM ubuntu RUN apt update && apt install -y curl CMD ["bash"]

2️⃣ Build an image:            podman build -t myimage .

3️⃣ Run the container:        podman run -it myimage


🎯 Summary of Key Commands

TaskCommand
Run a containerpodman run -it ubuntu bash
List containerspodman ps -a
Stop a containerpodman stop <container-id>
Remove a containerpodman rm <container-id>
Pull an imagepodman pull nginx
Build an imagepodman build -t myimage .
Create a podpodman pod create --name mypod -p 8080:80
Run inside a podpodman run -d --pod mypod nginx


Comments

Popular posts from this blog

Google Assistant Implementation in Android application with app actions

What is an android Activity,AppCompatActivity and Fragment Activity. Interview Question