manish srivastava
Posted on May 28, 2020
The Podman- an Open Containers Initiative-compliant container management tool, similar to Docker, Podman is very lightweight, there is no bigfat privileged daemon. It is built with safety in mind and it is a great alternative for development to Docker.
Did I said Podman is compliant with OCI ?.This implies among other things, that we can use any existing container image to substitute any Docker command with the Podman command, without changing anything. Current members of OCI as on 28 May 2020:
There is even an official package that provides backwards compatibility by more or less creating an alias from Docker to Podman.But first, why in the world would you stop using Docker? One thing that concerns me about Docker or, rather the way people treat Docker is that we forget about what Docker is.
Let's just explain that Docker is one of several tools for container management. This was definitely the first of its kind, widely embraced. And Docker certainly led to the industry's adoption of containers. But we have all used Docker for so long that we have stopped thinking 'container' and we think now that "Docker' is everywhere you go where you can see "Docker server," "Docker images" and "Docker registries."
And that's the language to use as an example Take "Git." Yet typically we say "git repository," and we see clearly the distinction between git as a common versions control system in the industry, and gitHub as just one of many services that collaborate on git repositories more clearly, or take Ubuntu by themselves. GitHub has been revolutionizing the way we all worked with Git repositories.
We all have various Linux preferences – I love Ubuntu, but in the end we all use Linux and all know that we use Linux operating system. We all have different preferences for Linux.
For containers, we need a similar mental change. We must understand what containers are and distinguish a line between containers and the instruments we use to work with them.
And to prove that Docker has good alternatives. But let me just talk about containers before I start. Some of you may think the alternative container management tools are not as completely developed as Docker. This
is a valid problem — no one would want to work with unstable broken applications. I'll show you how to use Podman to build and run container images.In your development environment you don't want to make a beta-test of fancy new apps.
But I am not going to give you a few reasons why you should not be worried:
(1) First of all, AWS Fargate, one of the most popular serverless platforms to run containers, dropped Docker in latest release .The beauty of this change is that it's just an implementation detail AWS Customers do not need to re-write their Dockerfiles they don't need to update their containers. From end user perspective Fargate works exactly as it did before. The only difference is that there is no Docker daemon .
(2) Openshift, one of the most popular enterprise Kubernetes platforms, replaced Docker with Cri-O back in June 2019. There is no sign of Docker in modern OpenShift clusters.
(3) OpenSUSE did exactly the same in 2018 - they switched to cri-o as the default container runtime for the Kubic project Kubernetes itself provides you with multiple choices during cluster installation.
(4) You can choose cri-o or just containerd and you won't even notice the difference in most cases More and more companies are shifting from "running Docker" to "running containers" and adapt new tools, all of which are standard-compliant and even work nicely with one another.
All of this means that in production environment Docker is just an implementation detail. You don't care which container runtime is used as long as it's stable and standards compliant To give another example, you don't care which hypervisor is used in your cloud provider.
As a developer you shouldn't be concerned with because if you don't know whether Docker is in production or not then nothing prevents you from attempting to build Docker solutions. Just do this and try Podman. Just try Podman.
What is the problem with Docker. Actually there are few,
• A single process could be a single point of failure.
• This process owned all the child processes (the running containers).
• If there is any failure in the docker daemon, then every child processes are lost its track.
• Building containers led to security vulnerabilities.
• All Docker operations had to be conducted by a user (or users) with the same full root authority.
Most importantly, there is no concept called daemon in podman. podman directly interact with Image registry, containers and image storage. with Linux kernel through the runC container runtime process (not a daemon) .
Above all, runC is a lightweight, portable container runtime. Docker is built on top of runC runtime container. Instead of using a daemon in podman, we directly use the runC runtime container.
Moving from Docker to Podman
Instead of Docker, you need to install Podman. You don't need to start or manage a daemon process like the Docker daemon. The commands you use with Docker will be the same for Podman.Docker images are compatible with Podman.Podman stores his containers and images in a place other than Docker.
Podman commands are same like docker ... just replace docker like podman pull , podman -ps , podman exec -it h33435dds bash etc...
Pull and Push to docker hub :) . Yes you can push and pull images from docker hub .
Next, I'm going to create a Containerfile. Containerfile is essentially a Dockerfile, with the one exception being that Podman's filename Developers choose this name to show explicitly that this file is not Podman-specific.
We should all start renaming our Dockerfiles to Containerfiles because multiple other Container Image Build Tools work with them Containerfile Contents are exactly the same as Dockerfile. We use the same FROM, RUN, ADD, EXPOSE and so on ...
After Containerfile is ready, we can create a container image. By default, Podman can seek to pull the image from a variety of public registries, including Dockerhub, to create the image with podman.
Finally, image is being created and we can see it by running the command "podman images" Now let's build a new container from this file. The reasons that "podman run" command accepts are more or less the same as those that "docker run" does.
Here we show all the container ports to the host and run this container in detached mode. By running the command "podman ps" We can see the container.
Podman opened a random port on the host, as we used capital "P" option. It looks like I don't want to manually execute the "podman run" command I need LanguageTool to run as a service at all times and the best way to run services on a Linux host is to use systemd.
Remember Podman does not come with a daemon-it relies on a much more stable and easy fork-exec model to spawn containers And fork and exec architecture allows to integrate Podman with systemd very nicely Podman generate command is very handy it takes the concept of one of the running containers and generates either a systemd unit file or a kubernetes pod yaml.
We did it as a personal user and not as a root user, and that's
the main difference you'll find while using Podman. There's no central, system-wide daemon that governs it.
We did it as a personal user and not as a root user, and that's the main difference you'll find while using Podman. There's no central, system-wide daemon that governs it.
Podman 's architecture helps the user who has this image and runs certain containers to properly scope every container image and container. No other person will see my photos or my containers on the network. What it means now is that I have to recreate the picture again. In reality, I don't have to rebuild that picture. There is a way for the users to copy container images.
If I restart the systemd operation, it will pick up this image and run the container, and that's all I wanted to show you today! I hope you know how easy to use Podman is. You may want to stick with Docker, but at least you know that there are different container management resources and that containers are not just Docker. If you or your company need advice or training on containerization topics, contact us.
ALSO READ: ROOTLESS DOCKER
Posted on May 28, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.