podman

podman

什么是podman?

Glcg8n.png

Podman 是一个开源的容器运行时项目,可在大多数 Linux 平台上使用。Podman 提供与 Docker 非常相似的功能。正如前面提到的那样,它不需要在你的系统上运行任何守护进程,并且它也可以在没有 root 权限的情况下运行。

Podman 可以管理和运行任何符合 OCI(Open Container Initiative)规范的容器和容器镜像。Podman 提供了一个与 Docker 兼容的命令行前端来管理 Docker 镜像。

  1. Podman 官网地址:https://podman.io/
  2. Podman 项目地址:https://github.com/containers/libpod

安装podman

Podman 目前已支持大多数发行版本通过软件包来进行安装,我们就以Centos8为例

Podman 在 CentOS 7 的默认 Extras 存储库和 CentOS 8 和 Stream 的 AppStream 存储库中可用

[root@localhost ~]# yum -y install podman

podman常用命令

使用 Podman 非常的简单,Podman 的指令跟 Docker 大多数都是相同的。下面我们来看几个常用的例子:

查看本机上的镜像

[root@localhost ~]# podman images 
REPOSITORY               TAG         IMAGE ID      CREATED      SIZE
docker.io/library/httpd  latest      ea28e1b82f31  11 days ago  148 MB

搜索镜像

加入-f is-official=true选项为搜索官方镜像

[root@localhost ~]# podman search -f is-official=true nginx
INDEX       NAME                     DESCRIPTION               STARS       OFFICIAL    AUTOMATED
docker.io   docker.io/library/nginx  Official build of Nginx.  15928       [OK]    

拉取镜像

[root@localhost ~]# podman pull docker.io/library/nginx:latest
Trying to pull docker.io/library/nginx:latest...
Getting image source signatures
Copying blob e5ae68f74026 skipped: already exists  
Copying blob 44be98c0fab6 done  
Copying blob 21e0df283cd6 done  
Copying blob 77700c52c969 done  
Copying blob 881ff011f1c9 done  
Copying blob ed835de16acd done  
Copying config f652ca386e done  
Writing manifest to image destination
Storing signatures
f652ca386ed135a4cbe356333e08ef0816f81b2ac8d0619af01e2b256837ed3e
[root@localhost ~]# podman images
REPOSITORY               TAG         IMAGE ID      CREATED      SIZE
docker.io/library/nginx  latest      f652ca386ed1  11 days ago  146 MB
docker.io/library/httpd  latest      ea28e1b82f31  12 days ago  148 MB

运行一个容器

[root@localhost ~]# podman run -d -P docker.io/library/httpd:latest
[root@localhost ~]# podman ps
CONTAINER ID  IMAGE                           COMMAND           CREATED         STATUS             PORTS                  NAMES
ba85d2cc50c8  docker.io/library/httpd:latest  httpd-foreground  54 seconds ago  Up 53 seconds ago  0.0.0.0:35355->80/tcp  hardcore_hertz
[root@localhost ~]# podman port hardcore_hertz 
80/tcp -> 0.0.0.0:35355

列出运行的容器

[root@localhost ~]# podman ps
CONTAINER ID  IMAGE                           COMMAND           CREATED             STATUS                 PORTS                  NAMES
ba85d2cc50c8  docker.io/library/httpd:latest  httpd-foreground  About a minute ago  Up About a minute ago  0.0.0.0:35355->80/tcp  hardcore_hertz

分析一个运行的容器

[root@localhost ~]# podman inspect -l |grep -i 'ip'
            "IPAddress": "10.88.0.2",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
                        "HostIp": "",
                    "IPAddress": "10.88.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "IPAMConfig": null,
                    
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值