首页 > 解决方案 > 在docker镜像“centos/python-36-centos7”中运行yum install时如何找到http url

问题描述

docker 在私有子网中运行,我需要打开基于 url 的白名单才能连接 Internet。例如,如果我添加“.fedoraproject.org”,那么在这个 docker 中,我们可以访问https://dl.fedoraproject.org

但是现在,当我 yum install package 时,我不知道如何检查“centos/python-36-centos7”使用的是哪个 http url。

这是我的 Dockerfile 的一部分:

FROM centos/python-36-centos7

# ...

RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
#needed by git-codecommit
# RUN yum -y install https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-1.7-1.x86_64.rpm
RUN wget https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-1.7-1.x86_64.rpm
RUN yum localinstall -y endpoint-repo-1.7-1.x86_64.rpm
RUN yum -y install git aws-cli cmake3

此命令yum -y install git aws-cli cmake3超时:

https://packages.endpoint.com/rhel/7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on https://packages.endpoint.com/rhel/7/os/x86_64/repodata/repomd.xml: (28, 'Operation timed out after 30001 milliseconds with 0 out of 0 bytes received')
https://packages.endpoint.com/rhel/7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on https://packages.endpoint.com/rhel/7/os/x86_64/repodata/repomd.xml: (28, 'Operation timed out after 30001 milliseconds with 0 out of 0 bytes received')
https://packages.endpoint.com/rhel/7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on https://packages.endpoint.com/rhel/7/os/x86_64/repodata/repomd.xml: (28, 'Operation timed out after 30001 milliseconds with 0 out of 0 bytes received')
[0mThe command '/bin/sh -c yum -y install git aws-cli cmake3' returned a non-zero code: 1

提前致谢!

标签: linuximagedockeryum

解决方案


我想这就是你要找的,

官方镜像的 docker 注册路径为library/(image),示例如下,

docker pull registry.hub.docker.com/library/busybox


推荐阅读