You Know Docker but Not Podman?

podman

Why Podman Is Gaining Popularity

If you’re familiar with Docker, you know how powerful it is for containerization. But have you heard of Podman? Podman is rapidly gaining traction due to its unique features, such as being daemonless and rootless, which make it more secure and flexible. However, switching from Docker to Podman can feel daunting—especially when you’re used to Docker commands like docker pull or docker run.

What if you could use those same commands with Podman? With bash aliases, you can 😉

In this guide, we’ll show you how to set up bash aliases to make Podman commands behave just like Docker commands, allowing you to transition effortlessly.

What Are Bash Aliases?

Bash aliases are shortcuts for longer or more complex commands. They allow you to type a simplified command in your terminal, and bash will automatically replace it with the corresponding longer command.

For instance, instead of typing ls -al, you could create an alias ll that does the same thing.

In the context of Podman, aliases can help you run Podman commands using familiar Docker syntax.

Step-by-Step Guide to Using Bash Aliases for Podman

Step 1: Open Your Shell Configuration File

To create bash aliases, you need to edit your shell’s configuration file. For most users, this will be either:

  • ~/.bashrc (for Bash users)
  • ~/.zshrc (for Zsh users)

Use a text editor to open the file of your choice: I will go with nano

nano ~/.bashrc

or for Zsh:

nano ~/.zshrc

Step 2: Add Your Aliases

Scroll to the bottom of the file and add the following lines to create Docker-like aliases for Podman:

alias docker="podman"
alias docker-compose="podman-compose"

This will map any docker or docker-compose commands directly to their Podman equivalents.

Step 3: Reload Your Shell Configuration

To activate your new aliases, reload your shell configuration file by running:

source ~/.bashrc

Testing Your New Aliases

Now that your aliases are set up, it’s time to test them. Try running a few commands that you’d typically use with Docker, such as:

docker pull alpine
docker run -it alpine

Now you are a podman expert 😉

en_US