How to Use Docker Hub with Podman – A Docker Alternative

How to Use Docker Hub with Podman – A Docker Alternative

If you're exploring a Docker alternative, Podman is a powerful and secure choice. It’s a daemonless container engine that fully supports Docker image formats and registries like Docker Hub.

This guide shows how to build an image with Podman, tag it properly, and push/pull it from Docker Hub.

Install Podman on Ubuntu

Run the following commands:

sudo apt update
sudo apt -y install podman
Check the version to confirm installation:

podman --version
Sample Dockerfile

FROM alpine:latest

# Install bash (optional but useful)
RUN apk add --no-cache bash

# Keep the container running with an infinite loop
CMD ["bash", "-c", "while true; do echo 'Podman is running...'; sleep 5; done"]

Step 1: Login to Docker Hub

podman login docker.io

Enter your Docker Hub username and password/token when prompted.
Step 2: Build the Image Using Podman

podman build -t myimage:latest .
Step 3: Tag the Image for Docker Hub

podman tag myimage docker.io/yourdockerhubusername/myimage:latest
Step 4: Push the Image to Docker Hub

podman push docker.io/yourdockerhubusername/myimage:latest
Step 5: Pull the Image from Docker Hub

podman pull docker.io/yourdockerhubusername/myimage:latest
Run it:

podman run docker.io/yourdockerhubusername/myimage:latest