DevOps – Podman: An alternative tool for Docker

Tram Ho

Docker is a tool used to manage and interact with containers, Docker is probably not too strange to everyone. However, in this container management array, there are also many other tools that can replace Docker, Podman is one of them.

Docker was released in 2013 as a completely free and open source version. However, in 2022, Docker is no longer completely free, but it comes with several versions of Personal, Pro, Team, and Business. If we use the free version, it will be limited to some things, such as “image pull rate limit” . Then most people have a habit that whenever something is free but naturally not free anymore, they will find something else that is free to use =))). So in today’s post we will learn about Podman.

Podman

Podman is an open source software developed by Redhat that is a tool for managing, building, and running containers.

If you know Kubernetes then Redhat designed Podman to work with K8S, so if you use K8S then Podman is a better choice than Docker.

Installing Podman

To install Podman on is quite simple.

MacOS.

Centos.

If you use Centos7 then type a few more commands as root.

Ubuntu 20.10 or later.

As for the Windows environment, you can see here Podman for Windows guide .

Getting Started

If you already use Docker, working with Podman will be very simple, because Podman has all the Docker commands. If you are using Docker on Linux and want to switch to Podman, simply add the alias docker=podman to the ~/.bashrc file.

You use Podman commands the same way you use Docker, for example, searching for images.

The way to pull Podman image is the same as how we use Docker, but the difference is that you will specify the name of the registry when pulling , otherwise by default it will pull from the registry registry.access.redhat.com , for example for example if we type.

It will pull from registry.access.redhat.com/library/httpd , so if you want to pull from docker hub then specify the registry as docker.io .

After pulling is complete to check the images on the machine, we type.

Running a container

To run the container using Podman is also very simple.

Check if the container is running.

So we have successfully run the container with Podman, calling it to see if it returns any results.

Delicious. If you need to see the logs of the container you type.

Stop a running container.

Delete container.

As you can see, manipulating Podman is very simple. And another important part is how to build Container Image , of course Podman also supports us to build image

Building images

Podman’s build file syntax is the same as Docker’s, except that with Docker, the default name of the build file is Dockerfile, and for Podman, it’s Containerfile. For example, we need to build a container image for Go using Podman of a source code written in Go.

Create a file named Containerfile at the same level as the 3 files above.

Paste the following code into the Containerfile file.

Run the build command.

Check out the container image we just built.

Done. Please like DevOps VN page to update DevOps news.

Conclusion

So we have learned about Podman, it is also very simple if you have ever used Docker. This is the sentence that I need to emphasize in the article: if you know Kubernetes, Redhat designed Podman to work with K8S, so if we use K8S, Podman is a better choice than Docker . If you have any questions or need further clarification, you can ask in the comment section below.

Share the news now

Source : Viblo