What Is Podman and what is the difference from Docker?
Podman is an OCI container compatible container engine that is also part of RedHat Linux, but can also be installed on other Linux distributions.
As it’s OCI-compliant, Podman can be used as a drop-in replacement for the better-known Docker runtime. Most Docker commands can be directly translated to Podman commands.
What’s a Runtime?
For many people, the Container Engine is Docker, but this does not represent the world of Container Engines at the moment, but there are many Container Engines like Podman.
As a result, Podman and Docker have basic functionality. Each produces images that the other can use to operate the containers The two runtimes then add their own specialisms on top of the base containerization features.
Install Podman
If you are using Red Hat Enterprise Linux 8, Podman is in the local repository, and you can install it by just using yum.
yum -y install podman
Most other Linux distributions include Podman in their default repositories
How to work with Containers and Images ?
Podman has several similarities to Docker in its run commands such as
1-How to pull image
podman pull my-image:latest
2- How to run image
podman run my-image:latest --name my-container
3-list created and running containers
podman ps
4-How to remove container
podman rm my-container
Podman difference from docker
Docker is a container management technology. Podman is also a container technology. You can use either for building container images and storing those images in a repository. You can also use either Docker or Podman to pull container images from a registry and then run them in a target environment
However, the technologies do have differences. First, while Docker has an underlying daemon, Podman uses a slightly different technology to create containers. Second, Podman, as the name implies, allows users to create pods. A pod is a way to group containers together under a common organizational name. Docker does not support pods. There are other subtle differences, but at a high level, these two differences are the most pronounced
1-Rootless Containers
Rootless containers refers to the ability for an unprivileged user to create, run and otherwise manage containers.
“Unprivileged user” in this context refers to a user who does not have any administrative rights
install slirp4netns:
yum install slirp4netns
configure a quantity of user-scoped network namespaces:
echo "user.max_user_namespaces=28633" > /etc/sysctl.d/userns.conf
sysctl -p /etc/sysctl.d/userns.conf
you can now run rootless container as ordinary user just Connect to the server as user .
when you Start a new container with podman run it will be created with the UID of your user account instead of root
Pods
Pods are the smallest deployable units of computing that you can create and manage which looks like kubernetes pods .
pod create:
podman pod create --name my-pod
add container to pods:
podman run --pod my-pod --name image-1 my-image:latest
can manage container in the pods :
podman kill my-pod # kill all containers
podman restart my-pod # restart all containers
podman stop my-pod #stop all containers
Conclusion
in conclusion podman is an container engine like docker have many similarities like how to pull image , run image . but have many differences like rootless container and pods