podman简介
Podman是一个开源项目,可在大多数Linux平台上使用并开源在GitHub上。Podman是一个无守护进程的容器引擎,用于在Linux系统上开发,管理和运行Open Container Initiative(OCI)容器和容器镜像。Podman提供了一个与Docker兼容的命令行前端,它可以简单地作为Docker cli,简单地说你可以直接添加别名:alias docker = podman来使用podman。
Podman控制下的容器可以由root用户运行,也可以由非特权用户运行。Podman管理整个容器的生态系统,其包括pod,容器,容器镜像,和使用libpod library的容器卷。Podman专注于帮助您维护和修改OCI容器镜像的所有命令和功能,例如拉取和标记。它允许您在生产环境中创建,运行和维护从这些映像创建的容器。
podman安装使用(使用centos官方yum源进行安装)
[root@podman01 ~]# yum install -y podman
[root@podman01 ~]# podman version
Version: 1.6.4
RemoteAPI Version: 1
Go Version: go1.12.12
OS/Arch: linux/amd64
配置镜像加速
[root@podman01 ~] # cp -p /etc/containers/registries.conf /etc/containers/registries.conf.20210813
[root@podman01 ~] # vi /etc/containers/registries.conf
unqualified-search-registries = ["docker.io"]
[[registry]]
prefix = "docker.io"
location = "uyah70su.mirror.aliyuncs.com"
拉取镜像
[root@podman01 ~] # podman pull centos
Trying to pull docker.io/library/centos...
Getting image source signatures
Copying blob 7a0437f04f83 done
Copying config 300e315adb done
Writing manifest to image destination
Storing signatures
300e315adb2f96afe5f0b2780b87f28ae95231fe3bdd1e16b9ba606307728f55
运行容器
[root@podman01 ~] # podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/centos latest 300e315adb2f 8 months ago 217 MB
[root@podman01 ~] # podman run -itd --name test centos sleep 3600
8f2232bf1691b19f2dcf21964641147a4d583fc9cec6b5a2f77b4f5ce22fdfaa
[root@podman01 ~] # podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8f2232bf1691 docker.io/library/centos:latest sleep 3600 25 seconds ago Up 20 seconds ago test
配置为别名
[root@podman01 ~]# echo "alias docker=podman" >> .bashrc
[root@podman01 ~]# source .bashrc
[root@podman01 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8f2232bf1691 docker.io/library/centos:latest sleep 3600 About a minute ago Up About a minute ago test
参考URL
http://docs.podman.io/en/latest/index.html
网友评论