环境
redhat-7.4
Docker version 1.13.1
背景
由于需要构建一个Dokcer image用来编译产品代码,主要操作系统是rhel-7.4,查了Reahat官网提供的基础image和命令(https://access.redhat.com/containers/#/explore),但是在执行命令的时候出现了问题
问题
拉取image出现的报错
[root@10-10-20-180 docker]# docker pull registry.access.redhat.com/rhel7
Using default tag: latest
Trying to pull repository registry.access.redhat.com/rhel7 ...
open /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory
报告没有redhat-ca.crt文件,查了下他的路径,发现是个软连接,指向/etc/rhsm/ca/redhat-uep.pem这个文件,而这个文件并不存在
[root@10-10-20-180 docker]# ll /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt
lrwxrwxrwx. 1 root root 27 Nov 13 17:20 /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt -> /etc/rhsm/ca/redhat-uep.pem
然后谷歌一圈,有个回复提示了一下:https://github.com/minishift/minishift/issues/2194
解决办法
- 找到redhat-uep.pem文件
find / -name "redhat-uep.pem"
/var/lib/docker/overlay2/75966419af8c75d9b69a80b6dc3413c9ddd31522ab24385741c2ab77b998190c/diff/etc/rhsm/ca/redhat-uep.pem
- 拷贝到/etc/rhsm/ca 目录下面
cp /var/lib/docker/overlay2/75966419af8c75d9b69a80b6dc3413c9ddd31522ab24385741c2ab77b998190c/diff/etc/rhsm/ca/redhat-uep.pem /etc/rhsm/ca
- 执行拉取命令
[root@10-10-20-180 docker]# docker pull registry.access.redhat.com/rhel7
Using default tag: latest
Trying to pull repository registry.access.redhat.com/rhel7 ...
latest: Pulling from registry.access.redhat.com/rhel7
50a402dbfd72: Pull complete
c6796217be8f: Pull complete
Digest: sha256:7ae7375bdbb23180d21dfed3408ba82f0d00dd049557cd62716a628367d31d61
Status: Downloaded newer image for registry.access.redhat.com/rhel7:latest