第一章 初识Podman‌

第一章 初识Podman‌

一、官网了解

地址:https://podman.io/

主页介绍:
最好的免费和开源容器工具
使用 Podman 管理容器、Pod 和映像。从本地环境无缝使用容器和 Kubernetes。

PodmanDocker
Podman 是无守护进程的Docker 有一个守护进程 (containerd) docker CLI 与守护进程交互以管理容器
Podman 直接通过 runc 与 Linux 内核交互Docker 守护进程拥有所有运行容器的子进程
Podman 可以部署具有多个容器的 pod。可以在 Kubernetes 中使用相同的 pod 清单。此外,您可以将 K8s pod 清单部署为 Podman pod。Docker 中没有 pod 的概念
无需任何额外配置即可运行无根容器( rootless)。您可以使用 root 或非特权用户运行容器。Docker 无根模式( rootless)需要额外的配置

二、CentOS 7 安装

这里个人使用Linux安装,我使用的是CentOS 7,Podman‌也支持windows和macOS,
下载地址:https://podman.io/docs/installation

1、Linux CentOS 命令安装

dnf -y install podman

在这里插入图片描述

2、检查安装结果

podman version

Centos 7 支持最高版本为 3.4.4
默认安装的是1.6.4 版本太旧

三、源码安装 3.4.4

1、安装go

# 临时关闭selinux
setenforce 0
# 安装golang,版本需要在 v1.6 以上
wget https://golang.google.cn/dl/go1.18.linux-amd64.tar.gz
tar xf go1.18.linux-amd64.tar.gz
mv go /usr/local/
ln -s /usr/local/go/bin/go /usr/local/bin/go
go version
# go version go1.18 linux/amd64

2、安装依赖

#  安装依赖
yum install -y \
  btrfs-progs-devel \
  containernetworking-plugins \
  containers-common \
  crun \
  device-mapper-devel \
  glib2-devel \
  glibc-devel \
  glibc-static \
  golang-github-cpuguy83-md2man \
  gpgme-devel \
  iptables \
  libassuan-devel \
  libgpg-error-devel \
  libseccomp-devel \
  libselinux-devel \
  make \
  pkgconfig

3、安装conmon 和 runc

# conmon是用C语言编写的工具,用于单个容器的管理器
wget https://github.com/containers/conmon/archive/refs/tags/v2.1.0.tar.gz
tar xf v2.1.0.tar.gz
cd conmon-2.1.0/
export GOCACHE="$(mktemp -d)"
make
make podman
#install  -D -m 755 bin/conmon /usr/local/libexec/podman/conmon
conmon --version
#conmon version 2.0.8
#commit: f85c8b1ce77b73bcd48b2d802396321217008762

# runc是golang写的关于CLI工具,用于根据OCI规范在 Linux上生成和运行容器
wget https://github.com/opencontainers/runc/releases/download/v1.1.1/runc.amd64
chmod +x runc.amd64
mv runc.amd64 /usr/local/bin/runc
/usr/local/bin/runc -version
#runc version 1.1.1
#commit: v1.1.0-20-g52de29d7
#spec: 1.0.2-dev
#go: go1.17.6
#libseccomp: 2.5.3

四、设置CNI网络

mkdir /etc/containers
wget https://src.fedoraproject.org/rpms/containers-common/raw/main/f/registries.conf
wget https://src.fedoraproject.org/rpms/containers-common/raw/main/f/default-policy.json
cp default-policy.json /etc/containers/default-policy.json
cp registries.conf /etc/containers/registries.conf
# 默认情况下,CNI网络配置文件下载好后,无需配置,即可使用 podman
# registries.conf: 容器镜像注册配置文件,文件格式为 TOML
# policy.json:证书安全策略文件,文件格式为 JSON

五、安装podman

wget https://github.com/containers/podman/archive/refs/tags/v3.4.4.tar.gz
tar xf v3.4.4.tar.gz
cd podman-3.4.4/
make BUILDTAGS="selinux seccomp"
# git clone -- https://github.com/cpuguy83/go-md2man /root/go/src/github.com/cpuguy83/go-md2man 超时问题
vim Makefile
####
# 800行 github.com/cpuguy83/go-md2man 改为
gitee.com/mirrors/go-md2man
####
# 再次make
make BUILDTAGS="selinux seccomp"
make install PREFIX=/usr
# 会自动在usr的bin、lib、share 中 创建相关内容
podman --version
# podman version 3.4.4
podman version
#Version:      3.4.4
#API Version:  3.4.4
#Go Version:   go1.18
#Built:        Wed Jun 29 15:51:56 2022
#OS/Arch:      linux/amd64


三、CentOS 9 安装
1、安装默认版本

sudo dnf -y install podman

在这里插入图片描述
版本查看

podman version

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

one one day

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值