What is Docker?
Docker is an open source application container engine, which belongs to a package of Linux container. Docker provides a simple and easy-to-use container interface, so that developers can package their applications and dependency packages into a portable container, and then publish them to any popular Linux machine. Containers are completely sandboxed, and there will be no interface between them.
Docker is the most popular Linux container solution at present. Even though docker is a very convenient tool for managing Linux containers, it also has two disadvantages:
Docker needs to run a daemon on your system.
Docker runs the daemon on your system as root.
The existence of these shortcomings may have certain security risks. In order to solve these problems, the next generation container tool Podman appeared.
What is Podman?
Podman is a daemon free container engine launched by RedHat company, which is used to develop, manage and run OCI containers on Linux system,
Podman is an open source Linux native tool without daemons, designed to easily find, run, build, share, and deploy applications using open container Initiative (OCI) containers and container images.
Advantage: can be run by non root users
Podman is an open source container runtime project
Podman can manage and run any container and container image conforming to OCI (Open Container Initiative) specification. Podman provides a Docker compatible command line front end to manage Docker images.
docker and podman start differently
Containers start differently:
The Docker CLI command interacts with the docker engine through the API to tell it that I want to create a container, and then the docker engine will call OCI container runtime(runc) to start a container. This means that the process of the container will not be the child process of Docker CLI, but the child process of docker engine.
Podman directly interacts with OCI container runtime (runc) to create a container, so the container process is directly the child process of podman.
Because docker has docker daemon, the container started by docker supports the restart policy, but podman does not. If this problem does not exist in k8s, we can set the restart policy of pod. In the system, we can write systemd service to complete self startup
Install Podman
install
[root@rzk ~]# sudo yum -y install podman
View version
[root@rzk opt]# podman -v podman version 3.3.1
Installing nginx
Search nginx
[root@rzk opt]# podman search nginx INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED docker.io docker.io/library/nginx Official build of Nginx. 16062 [OK] docker.io docker.io/jwilder/nginx-proxy Automated Nginx reverse proxy for docker con... 2105 [OK] docker.io docker.io/nginxinc/nginx-unprivileged Unprivileged NGINX Dockerfiles 56 docker.io docker.io/nginx/nginx-ingress NGINX and NGINX Plus Ingress Controllers fo... 59 docker.io docker.io/nginxdemos/hello NGINX webserver that serves a simple page co... 81 [OK] docker.io docker.io/nginx/nginx-prometheus-exporter NGINX Prometheus Exporter for NGINX and NGIN... 22 docker.io docker.io/richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable of... 819 [OK] docker.io docker.io/privatebin/nginx-fpm-alpine PrivateBin running on an Nginx, php-fpm & Al... 61 [OK] docker.io docker.io/jlesage/nginx-proxy-manager Docker container for Nginx Proxy Manager 148 [OK] docker.io docker.io/mailu/nginx Mailu nginx frontend 10 [OK] docker.io docker.io/jc21/nginx-proxy-manager Docker container for managing Nginx proxy ho... 303 docker.io docker.io/linuxserver/nginx An Nginx container, brought to you by LinuxS... 161 docker.io docker.io/wodby/nginx Generic nginx 1 [OK] docker.io docker.io/nginxproxy/nginx-proxy Automated Nginx reverse proxy for docker con... 33 docker.io docker.io/schmunk42/nginx-redirect A very simple container to redirect HTTP tra... 19 [OK] docker.io docker.io/centos/nginx-112-centos7 Platform for running nginx 1.12 or building ... 16 docker.io docker.io/staticfloat/nginx-certbot Opinionated setup for automatic TLS certs lo... 25 [OK] docker.io docker.io/ansibleplaybookbundle/nginx-apb An APB to deploy NGINX 3 [OK] docker.io docker.io/tiangolo/nginx-rtmp Docker image with Nginx using the nginx-rtmp... 148 [OK] docker.io docker.io/alfg/nginx-rtmp NGINX, nginx-rtmp-module and FFmpeg from sou... 112 [OK] docker.io docker.io/centos/nginx-18-centos7 Platform for running nginx 1.8 or building n... 13 docker.io docker.io/sophos/nginx-vts-exporter Simple server that scrapes Nginx vts stats a... 7 [OK] docker.io docker.io/flashspys/nginx-static Super Lightweight Nginx Image 11 [OK] docker.io docker.io/bitwarden/nginx The Bitwarden nginx web server acting as a r... 12 docker.io docker.io/webdevops/nginx Nginx container 9 [OK]
Pull image
[root@rzk opt]# podman pull docker.io/library/nginx
Run nginx
--Name "what name do you want" "image name"
[root@rzk opt]# podman run -t -d -p 8221:80 --name nginx docker.io/library/nginx 4636fa10587ff273e0c66d5ff5404014799f22f765be8f3d58a67de86ba635