Podman(Pod Manager)是一个功能齐全的容器引擎,是一个简单的无守护程序工具。Podman提供了一个与Docker-CLI类似的命令行,可以轻松地从其他容器引擎过渡,并允许管理Pod、容器和图像。简单地说: alias docker=podman 。大多数Podman命令都可以作为普通用户运行,而不需要额外的权限。
Podman在内部使用Buildah(1)创建容器映像。这两个工具共享图像(而不是容器)存储,因此每个工具都可以使用或操作对方创建的图像(但不能操作容器)。
标志的默认设置在中定义 f 。远程连接的大多数设置都使用服务器的f,手册页中记录的情况除外。
dockers在实现CRI的时候,它需要一个守护进程,以root权限运行这样会带来安全隐患,而podman不需要守护进程和root权限。
在docker的运行体系中,需要多个daemon才能调用到OCI的实现RunC。
在容器管理的链路中,Docker Engine的实现就是dockerd
daemon,它在linux中需要以root运行,dockerd调用containerd,containerd调用containerd-shim,然后才能调用runC。顾名思义shim起的作用也就是“垫片”,避免父进程退出影响容器的运行
安装podman
[root@localhost ~]# yum -y install podman
配置podman
[root@localhost ~]# vim /etc/f
# unqualified-search-registries = ["registry.fedoraproject", "dhat", s", "docker.io"]unqualified-search-registries = ["docker.io"]
[[registry]]
prefix = "docker.io"
location = "wlfs9l74.mirror.aliyuncs"
创建并启动容器
[root@localhost ~]# podman run --name httpd busybox:latest
[root@localhost ~]# podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d36984b8d048 docker.io/library/busybox:latest sh About a minute ago Up 3 seconds ago httpd
[root@localhost ~]# podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d36984b8d048 docker.io/library/busybox:latest sh 12 seconds ago Up 12 seconds ago httpd
[root@localhost ~]# podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d36984b8d048 docker.io/library/busybox:latest sh 12 seconds ago Up 12 seconds ago httpd
[root@localhost ~]# podman stop httpd
[root@localhost ~]# podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d36984b8d048 docker.io/library/busybox:latest sh 41 seconds ago Exited (137) 8 seconds ago httpd
[root@localhost ~]# podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d36984b8d048 docker.io/library/busybox:latest sh 2 minutes ago Up About a minute ago httpd
[root@localhost ~]# podman restart httpd
[root@localhost ~]# podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d36984b8d048 docker.io/library/busybox:latest sh 2 minutes ago Up 1 second ago httpd
[root@localhost ~]# podman attach httpd
/ #
[root@localhost ~]# podman exec -it httpd /bin/sh
/ #
[root@localhost ~]# podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d36984b8d048 docker.io/library/busybox:latest sh 8 minutes ago Up 2 minutes ago httpd
[root@localhost ~]# podman rm -f httpd
[root@localhost ~]# podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@localhost ~]# podman logs httpd
[root@localhost ~]# podman search httpd
NAME DESCRIPTION
docker.io/library/httpd The Apache HTTP Server Project
docker.io/clearlinux/httpd httpd HyperText Transfer Protocol (HTTP) server program with the benefits of Clear Linux OS
docker.io/centos/httpd-24-centos7 Platform for running Apache httpd 2.4 or building httpd-based application
[root@localhost ~]# podman pull centos
Resolved "centos" as an alias (/etc/f.f)
Trying to pull quay.io/centos/
Getting image source signatures
Copying blob 7a0437f04f83 done
Copying config 300e315adb done
Writing manifest to image destination
Storing signatures
300e315adb2f96afe5f0b2780b87f28ae95231fe3bdd1e16b9ba606307728f55
[root@localhost ~]# podman images
quay.io/centos/centos latest 300e315adb2f 20 months ago 217 MB
[root@localhost ~]# podman images
quay.io/centos/centos latest 300e315adb2f 20 months ago 217 MB
quay.io/centos/centos latest 300e315adb2f 20 months ago 217 MB
[root@localhost ~]# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/busybox latest beae173ccac6 7 months ago 1.46 MB
docker.io/ningnoob/ceshi g1 beae173ccac6 7 months ago 1.46 MB
localhost/ningnoob/ceshi c1 beae173ccac6 7 months ago 1.46 MB
quay.io/centos/centos latest 300e315adb2f 20 months ago 217 MB
[root@localhost ~]#
[root@localhost ~]# podman rmi localhost/ningnoob/ceshi:c1
Untagged: localhost/ningnoob/ceshi:c1
[root@localhost ~]# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/busybox latest beae173ccac6 7 months ago 1.46 MB
docker.io/ningnoob/ceshi g1 beae173ccac6 7 months ago 1.46 MB
quay.io/centos/centos latest 300e315adb2f 20 months ago 217 MB
[root@localhost ~]# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/busybox latest beae173ccac6 7 months ago 1.46 MB
docker.io/ningnoob/ceshi g1 beae173ccac6 7 months ago 1.46 MB
quay.io/centos/centos latest 300e315adb2f 20 months ago 217 MB
[root@localhost ~]# podman image rm docker.io/ningnoob/ceshi:g1
Untagged: docker.io/ningnoob/ceshi:g1
[root@localhost ~]# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/busybox latest beae173ccac6 7 months ago 1.46 MB
quay.io/centos/centos latest 300e315adb2f 20 months ago 217 MB
[root@localhost ~]# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/busybox latest beae173ccac6 7 months ago 1.46 MB
quay.io/centos/centos latest 300e315adb2f 20 months ago 217 MB
[root@localhost ~]#
[root@localhost ~]# podman tag docker.io/library/busybox:latest docker.io/ningnoob/ceshi:s1
[root@localhost ~]# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/busybox latest beae173ccac6 7 months ago 1.46 MB
docker.io/ningnoob/ceshi s1 beae173ccac6 7 months ago 1.46 MB
quay.io/centos/centos latest 300e315adb2f 20 months ago 217 MB
[root@localhost ~]# podman login
Username: ningnoob
Password:
Login Succeeded!
[root@localhost ~]# podman push docker.io/ningnoob/ceshi:s1
Getting image source signatures
Copying blob 01fd6df81c8e skipped: already exists
Copying config beae173cca done
Writing manifest to image destination
Storing signatures
本文发布于:2024-02-02 10:23:54,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170684063343173.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |