CentOS Stream 9 安装与使用 Podman 完整笔记

一、安装 Podman
CentOS Stream 9 默认包含 Podman,直接安装即可:
# 更新系统(推荐) sudo dnf update -y # 安装 Podman sudo dnf install -y podman # 验证版本 podman --version # 输出示例:podman version 4.9.0
Podman 在 CentOS Stream 9 上默认使用:
overlay 存储驱动(高性能)
cgroups v2
rootless 容器支持
二、解决国内无法拉取 Docker 镜像问题
问题现象
podman pull alpine # 报错:connection timed out to registry-1.docker.io
解决方案:配置国内镜像加速器
1. 使用阿里云网易百度腾讯公开镜像(推荐,无需账号)sudo vim /etc/containers/registries.confunqualified-search-registries = ["docker.io"] [[registry]] prefix = "docker.io" location = "registry.cn-hangzhou.aliyuncs.com" # 阿里云镜像加速 [[registry.mirror]] location = "hub-mirror.c.163.com" # 网易镜像 [[registry.mirror]] location = "mirror.baidubce.com" # 百度镜像 [[registry.mirror]] location = "ccr.ccs.tencentyun.com" # 腾讯云镜像2. (可选)添加中科大镜像作为备用
[[registry.mirror]] location = "docker.mirrors.ustc.edu.cn"3. 验证配置
# 测试拉取
podman run --rm alpine echo "? 镜像加速生效!"
# 查看镜像源配置
podman info --format '{{.Registries}}' 
网易镜像 hub-mirror.c.163.com 是目前最稳定、公开可用的 Docker Hub 代理。
三、Podman 常用操作
1. ...
点击查看剩余70%
网友评论