CentOS8系统新特性--Podman容器(再见Docker)
CentOS8 安装Podman容器管理软件
CentOS8中dnf代替了yum 包管理软件
sudo dnf install -y podman 或 yum install -y podman [root@Centos8 ~]# yum install -y podman CentOS-8 - AppStream 1.2 MB/s | 6.0 MB 00:04 CentOS-8 - Base 610 kB/s | 4.0 MB 00:06 CentOS-8 - Extras 582 B/s | 2.1 kB 00:03 上次元数据过期检查:0:00:01 前,执行于 2020年01月24日 星期五 21时50分14秒。 Package podman-1.0.0-2.git921f98f.module_el8.0.0+58+91b614e7.x86_64 is already installed. 依赖关系解决。 ======================================================================================================================= 软件包 架构 版本 仓库 大小 ======================================================================================================================= Upgrading: containernetworking-plugins x86_64 0.8.1-2.module_el8.1.0+237+63e26edc AppStream 20 M podman x86_64 1.4.2-5.module_el8.1.0+237+63e26edc AppStream 11 M 安装依赖关系: podman-manpages noarch 1.4.2-5.module_el8.1.0+237+63e26edc AppStream 180 k 安装弱的依赖: libvarlink x86_64 18-3.el8 BaseOS 44 k 事务概要 ======================================================================================================================= 安装 2 软件包 升级 2 软件包 总下载:32 M 下载软件包: CentOS-8 - Base 196% [=========================================================================(1/4): podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch.rpm 137 kB/s | 180 kB 00:01 (2/4): libvarlink-18-3.el8.x86_64.rpm 34 kB/s | 44 kB 00:01 (3/4): podman-1.4.2-5.module_el8.1.0+237+63e26edc.x86_64.rpm 4.9 MB/s | 11 MB 00:02 (4/4): containernetworking-plugins-0.8.1-2.module_el8.1.0+237+63e26edc.x86_64.rpm 4.0 MB/s | 20 MB 00:04 ----------------------------------------------------------------------------------------------------------------------- 总计 4.0 MB/s | 32 MB 00:07 警告:/var/cache/dnf/AppStream-a520ed22b0a8a736/packages/podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 8483c65d: NOKEY CentOS-8 - AppStream 1.6 MB/s | 1.6 kB 00:00 导入 GPG 公钥 0x8483C65D: Userid: "CentOS (CentOS Official Signing Key) <security@centos.org>" 指纹: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D 来自: /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial 导入公钥成功 运行事务检查 事务检查成功。 运行事务测试 事务测试成功。 运行事务 准备中 : 1/1 运行脚本 : containernetworking-plugins-0.8.1-2.module_el8.1.0+237+63e26edc.x86_64 1/1 Upgrading : containernetworking-plugins-0.8.1-2.module_el8.1.0+237+63e26edc.x86_64 1/6 Installing : libvarlink-18-3.el8.x86_64 2/6 运行脚本 : libvarlink-18-3.el8.x86_64 2/6 Installing : podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch 3/6 Upgrading : podman-1.4.2-5.module_el8.1.0+237+63e26edc.x86_64 4/6 清理 : podman-1.0.0-2.git921f98f.module_el8.0.0+58+91b614e7.x86_64 5/6 运行脚本 : podman-1.0.0-2.git921f98f.module_el8.0.0+58+91b614e7.x86_64 5/6 /var/tmp/rpm-tmp.B6dXMD:行1: /usr/bin/podman: 权限不够 清理 : containernetworking-plugins-0.7.4-3.git9ebe139.module_el8.0.0+58+91b614e7.x86_64 6/6 运行脚本 : containernetworking-plugins-0.7.4-3.git9ebe139.module_el8.0.0+58+91b614e7.x86_64 6/6 验证 : podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch 1/6 验证 : libvarlink-18-3.el8.x86_64 2/6 验证 : containernetworking-plugins-0.8.1-2.module_el8.1.0+237+63e26edc.x86_64 3/6 验证 : containernetworking-plugins-0.7.4-3.git9ebe139.module_el8.0.0+58+91b614e7.x86_64 4/6 验证 : podman-1.4.2-5.module_el8.1.0+237+63e26edc.x86_64 5/6 验证 : podman-1.0.0-2.git921f98f.module_el8.0.0+58+91b614e7.x86_64 6/6 已升级: containernetworking-plugins-0.8.1-2.module_el8.1.0+237+63e26edc.x86_64 podman-1.4.2-5.module_el8.1.0+237+63e26edc.x86_64 已安装: libvarlink-18-3.el8.x86_64 podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch 完毕
CentOS8 下通过Podman创建管理容器
1)Podman常见命令
[root@Centos8 ~]# podman pull ubuntu
Trying to pull docker.io/library/ubuntu...Getting image source signatures
Copying blob 19a861ea6baf done
Copying blob c63719cdbe7a done
Copying blob 5c939e3a4d10 done
Copying blob 651c9d2d6c4f done
Copying config ccc6e87d48 done
Writing manifest to image destination
Storing signatures
ccc6e87d482b79dd1645affd958479139486e47191dfe7a997c862d89cd8b4c0
2)Podman镜像管理
[root@Centos8 ~]# podman images
REPOSITORY                 TAG      IMAGE ID       CREATED      SIZE
docker.io/library/ubuntu   latest   ccc6e87d482b   9 days ago   66.6 MB
[root@Centos8 ~]#
3)Podman创建容器
[root@Centos8 ~]# podman ps -a
CONTAINER ID  IMAGE  COMMAND  CREATED  STATUS  PORTS  NAMES
[root@Centos8 ~]#
[root@Centos8 ~]# podman run docker.io/library/ubuntu:latest
[root@Centos8 ~]# podman ps -a
CONTAINER ID  IMAGE                            COMMAND    CREATED        STATUS                    PORTS  NAMES
23a1fd0b4a89  docker.io/library/ubuntu:latest  /bin/bash  6 seconds ago  Exited (0) 4 seconds ago         gallant_kowalevski
[root@Centos8 ~]#
#进入容器
[root@Centos8 ~]# podman run -i -t docker.io/library/ubuntu:latest
root@4fd02ab43ad5:/#
root@4fd02ab43ad5:/# ls
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
root@4fd02ab43ad5:/#
4)Podman 停止容器
[root@Centos8 ~]# podman stop 4fd02ab43ad5
4fd02ab43ad5e9ebd2c9d6f0c5509b2ccef2c4d28fde09f9878d5e5d8e38405e
5)Podman 启动容器
[root@Centos8 ~]# podman start 4fd02ab43ad5
4fd02ab43ad5
[root@Centos8 ~]# podman ps -a
CONTAINER ID  IMAGE                            COMMAND    CREATED        STATUS                    PORTS  NAMES
4fd02ab43ad5  docker.io/library/ubuntu:latest  /bin/bash  6 minutes ago  Up 2 seconds ago                 vigorous_chandrasekhar
23a1fd0b4a89  docker.io/library/ubuntu:latest  /bin/bash  7 minutes ago  Exited (0) 7 minutes ago         gallant_kowalevski
[root@Centos8 ~]#
6)Podman 查看容器列表
[root@Centos8 ~]# podman ps -a
CONTAINER ID  IMAGE                            COMMAND    CREATED        STATUS                    PORTS  NAMES
4fd02ab43ad5  docker.io/library/ubuntu:latest  /bin/bash  6 minutes ago  Up 2 seconds ago                 vigorous_chandrasekhar
23a1fd0b4a89  docker.io/library/ubuntu:latest  /bin/bash  7 minutes ago  Exited (0) 7 minutes ago         gallant_kowalevski
[root@Centos8 ~]#
7)Podman查看容器详细信息
podman inspect 容器名
其他操作跟Docker操作类似
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号