Podman is a container runtime which provides the same features of Docker. The main difference is that it doesn’t require any running daemon (like dockerd) to run on your system. Pods and containers processes are created as children of the Podman tool. Besides it, it can also run without root privileges. So let’s see how we can use it to run some simple Linux containers and WildFly application server.
The installation of podman is quite simple: all you need is using the yum/dnf tool to install the “podman” library:
$ sudo dnf install podman
If you don’t want to install Podman on your machine, you can still use as playground Katacoda cloud service: https://katacoda.com/courses/containers-without-docker/running-containers-with-podman
Running containers with Podman
One of the simplest examples could be running an HelloWorld container:
$ podman run hello-world Trying to pull repository docker.io/library/hello-world ... Hello from Docker!
The CLI for Podman is compatible with Docker, meaning it should feel familiar. For example, if you were to build a new image, you can use a Dockerfile and build it using podman build command. For example:
cat > Dockerfile <<EOF >FROM fedora:28 >RUN dnf -y install cowsay >EOF
Now build the image with:
$ podman build . -t hello-world
And execute the container with:
$ podman run --rm -it hello-world cowsay "Hello!"
Unlike the Docker CLI, Podman does not rely on a Container Engine such as the Docker daemon or CRI-O. Podman creates the containerized processes and makes the necessary changes on disk itself. Podman relies on a library called containers/images for pulling Container Images from Registry Servers. It also uses containers/storage to manage images on disk on the Container Host. These are the same libraries that CRI-O uses, so container images pulled by Podman can be shared and used with CRI-O.
Running WildFly container with Podman
Now let’s move intoo wildfly land. You might wonder how WildFly runs with Podman: we have just checked it: it’s pretty simple just replace the docker command line with podman:
As you can see from the above picture, we have used ‘podman ps’ to track the running container processes. If you tried to run the same command with docker CLI, it would return an empty list, as containers are not running via Docker!
We can check the virtual IP Address that has been assigned to your container and reach it out:
Besides running containers, you can use Podman also to interact with container registries like docker.io. To do that, simply log in to a container registry like Docker Hub:
$ podman login docker.io
Now you can push the images you have built, taking care to tag it so it refers to the specific container registry and my personal namespace, and then simply push it.
$ podman -t mywildfly docker.io/user/mywildfly $ podman push docker.io/user/mywildfly