Files
Knowledge/1 使用/docker/Podman使用国内阿里镜像源(centos8).md
T

40 lines
1.9 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Podman是一个开源的容器管理工具,语法兼容 Docker,但是某些方面比原生 Docker 命令更好用,比如能够以非root用户的身份去运行容器,而且不需要守护进程。
Podman引入了一个注册表的概念,注册表就是包括 ​ [​docker.io​](http://docker.io/)​ 在内的多个容器镜像源,默认的有 redhat docker fedora centos quay。
国内直接用 podman pull 拉取镜像会很慢,所以需要配置国内镜像源来加速访问。国内的镜像源有以下:
- docker官方中国区: https://registry.docker-cn.com
- 网易: http://hub-mirror.c.163.com
- USTC: http://docker.mirrors.ustc.edu.cn
- 阿里云: http://<你的ID>.mirror.aliyuncs.com
#### 1.修改Podman的注册表配置文件
```vim /etc/containers/registries.conf
unqualified-search-registries = ["docker.io"]
[[registry]]
prefix = "docker.io"
location="d1234.mirror.aliyuncs.com"
```
![Podman使用国内阿里镜像源(centos8)_镜像源](https://s2.51cto.com/images/202210/2543b6277188f49e0ca7218d11956db31151e0.png?x-oss-process=image/watermark,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=,x-oss-process=image/resize,m_fixed,w_1184/format,webp)
注:此处location的值只需要填写​ https:// 之后的内容就行了​​
#### 3.测试是否可以拉取对应的镜像
podman pull hello-world
![Podman使用国内阿里镜像源(centos8)_docker_02](https://s2.51cto.com/images/blog/202210/20084012_635098ece6da545696.png?x-oss-process=image/watermark,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=,x-oss-process=image/resize,m_fixed,w_1184/format,webp)
**注意:由于podman目前还不是很完善,好些镜像还是无法下载到(可以通过docker下载完镜像后导入到podman安装的那台机器上也是可以正常使用的)**