Podman Introduction, Installation, Basic Operations

Posted by javamint on Fri, 28 Jan 2022 05:53:27 +0100

Introduction to Podman

What is Podman?

podman is a container engine for daemon-less based Linux systems. Containers that can be used to develop, manage and run OCI standards. podman can run in root or non-root user mode.

Podman was launched by Red Hat in 2018 with open source code.

Official website https://podman.io/

OCI https://opencontainers.org/

Differences from docker

  • The main difference is that podman is Daemonless, and Docker must rely on the docker daemon in the background when performing tasks.
  • podman is more secure because it does not require root users or root privileges. (the main difference)
  • podman can create pods, and the concept of pod is similar to that defined in Kubernetes
  • The podman runs to store the image and container in different places, but the docker must be stored locally in the docker engineer
  • podman is the traditional fork-exec mode, while docker is the client-server architecture

Frame differences

Docker architecture

Podman architecture

Installation of Podman

Installation Document Address: https://podman.io/getting-started/installation

Podman is a Linux program that does not run on Windows, but can run clients and send them to Linux server operations.

Windows uses

_Podman is a tool for running linux containers. You can do this from the Windows desktop as long as you have access to the linux chassis running within the VM on the host or available over the network. You need to install the remote client and then podman-remote. Set ssh connection information in conf file. Podman can also run on a Windows subsystem linux system, see the link below for instructions on how to do this. _

Remote Client

Windows Subsystem for Linux (WSL) 2.0

Linux distribution

Arch Linux & Manjaro Linux

sudo pacman -S podman

CentOS

_Podman is available in the default Extras repository for CentOS 7 and the AppStream repository for CentOS 8 and Stream. _

sudo yum -y install podman

Debian

_The podman package is available in the Debian 11 (Bullseye) repository and later. _

sudo apt-get -y install podman

Ubuntu

The podman package is available in Ubuntu 20.10 and later official repositories.

# Ubuntu 20.10 and newer
sudo apt-get -y update
sudo apt-get -y install podman

Source Installation

Check carefully if the golang version is new enough (that is, January 2022 version 1.16). x or higher is required. The current minimum required version is always available in go. mod file. If needed, the golang suite can be https://golang.org/dl/. Alternatively, go can be built from source code, as shown below (keeping the system go installation is helpful to avoid having to boot the go:go version)

export GOPATH=~/go
git clone https://go.googlesource.com/go $GOPATH
cd $GOPATH
cd src
./all.bash
export PATH=$GOPATH/bin:$PATH

First, make sure the first value found on $PATH is above 1.12.x. If needed, the instructions above will help you compile a newer version of Go. Then we can build the Podman:go version

git clone https://github.com/containers/podman/
cd podman
make BUILDTAGS="selinux seccomp"
sudo make install PREFIX=/usr

Build Tags
In addition, if you don't want to build a Podman with seccomp or selinux support, you can add it when you run make. BUILDTAGS=""

make BUILDTAGS=""
sudo make install

Get started quickly

Install a Nginx

Same as docker's command

You can even change the podman keyword to docker

Start the Nginx container

[root@python ~]# podman image pull docker.io/library/nginx 
Trying to pull docker.io/library/nginx...
Getting image source signatures
Copying blob 091c283c6a66 skipped: already exists  
Copying blob 55de5851019b skipped: already exists  
Copying blob 5eb5b503b376 skipped: already exists  
Copying blob 1ae07ab881bd skipped: already exists  
Copying blob 78091884b7be skipped: already exists  
Copying blob b559bad762be [--------------------------------------] 0.0b / 0.0b
Copying config c316d5a335 done  
Writing manifest to image destination
Storing signatures
c316d5a335a5cf324b0dc83b3da82d7608724769f6454f6d9a621f3ec2534a5a
[root@python ~]# podman image ls
REPOSITORY                TAG      IMAGE ID       CREATED        SIZE
docker.io/library/nginx   latest   c316d5a335a5   32 hours ago   146 MB
[root@python ~]# podman container run docker.io/library/nginx
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2022/01/27 18:04:36 [notice] 1#1: using the "epoll" event method
2022/01/27 18:04:36 [notice] 1#1: nginx/1.21.6
2022/01/27 18:04:36 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6) 
2022/01/27 18:04:36 [notice] 1#1: OS: Linux 3.10.0-693.11.1.el7.x86_64
2022/01/27 18:04:36 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2022/01/27 18:04:36 [notice] 1#1: start worker processes
2022/01/27 18:04:36 [notice] 1#1: start worker process 30

Topics: Docker Kubernetes Container Podman