Podman安装和使用

本文详细介绍了Podman的安装步骤和使用方法,包括搜索、运行、构建容器等操作。此外,还特别讨论了如何让普通用户在没有root权限的情况下安全使用Podman,涉及slirp4netns、fuse-overlayfs的安装,以及/etc/subuid和/etc/subgid的配置。用户配置文件的管理和使用volumes也进行了讲解。
摘要由CSDN通过智能技术生成

安装podman

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

podman使用

  • podman search
[root@192 ~]# podman search busybox
INDEX       NAME                               DESCRIPTION                                      STARS       OFFICIAL    AUTOMATED
docker.io   docker.io/library/busybox          Busybox base image.                              2415        [OK]        
docker.io   docker.io/radial/busyboxplus       Full-chain, Internet enabled, busybox made f...  43                      [OK]
docker.io   docker.io/yauritux/busybox-curl    Busybox with CURL                                16                      
......
和docker不同的是镜像会跟上仓库的位置
  • 运行一个容器
[root@192 ~]# podman run -it docker.io/library/busybox /bin/sh
Trying to pull docker.io/library/busybox:latest...
Getting image source signatures
Copying blob 3cb635b06aa2 done  
Copying config ffe9d497c3 done  
Writing manifest to image destination
Storing signatures
/ # 
  • 构建一个容器
//使用由 Nginx 维护并在 GitHub 上发布的 Dockerfile构建 Nginx Web 服务器

[root@192 ~]#podman build -t nginx https://git.io/Jf8ol
//此处的https://git.io/Jf8ol已失效,根据自己需求自行查找可用的dockerfile所在网址
  • 查看镜像
[root@192 ~]# podman images
REPOSITORY                 TAG         IMAGE ID      CREATED      SIZE
docker.io/library/busybox  latest      ffe9d497c324  6 days ago   1.46 MB
docker.io/library/nginx    latest      f652ca386ed1  11 days ago  146 MB
  • 上传镜像
//登录
[root@192 ~]# docker login docker.io
-bash: docker: command not found
[root@192 ~]# podman login docker.io
Username:          //用户名
Password:           //密码
Login Succeeded!         //登录成功

//上传镜像
[root@192 ~]# podman push docker.io/soumnswa/nginx:latest 
  • 运行实例容器
podman run -dt -p 8080:8080/tcp -e HTTPD_VAR_RUN=/run/httpd -e HTTPD_MAIN_CONF_D_PATH=/etc/httpd/conf.d \ 
                  -e HTTPD_MAIN_CONF_PATH=/etc/httpd/conf \ 
                  -e HTTPD_CONTAINER_SCRIPTS_PATH= share/container-scripts/httpd/\ 
                  registry.fedoraproject.org/f29/httpd /usr/bin/run-httpd
  • 查看运行的容器
[root@192 ~]# podman ps 
CONTAINER ID  IMAGE                     
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值