无法使用Docker Build下载软件包

问题描述 投票:1回答:1

我正在使用DockerFile创建一个docker镜像。当我执行docker build命令时出现错误,以下是详细信息

docker build -f Dockerfile.app --no-cache --rm --label 'APS_INFO=OS/CentOS/7.6/-baseurl=http://repo.lab.pl.nikhil.com/centos-remote/7.7.1908/os/x86_64/-' --label BUILDTIME=2020-03-29T09:26:54+0530 --build-arg=BASE_IMAGE=nikhil/myrepo/linuximsbase:20.5_11-Mar-2020 --build-arg=IMAGE_BUILD=admincli -t nikhil/myrepo/admincli:latest -t nikhil/myrepo/admincli:_29-Mar-2020 .

(yum:77): libdnf-WARNING **: 03:57:29.180: Skipping refresh of base: cannot update repo 'base': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried; Last error: Curl error (28): Timeout was reached for http://repo.lab.pl.nikhil.com/centos-remote/7.7.1908/os/x86_64/repodata/repomd.xml [Connection timed out after 30001 milliseconds]

我已经使用HTTP_PROXY启动了docker服务

....
Environment="NO_PROXY=localhost,10.200.200.3,127.0.0.1"
Environment="HTTP_PROXY=http://10.158.100.6:8080/"
Environment="HTTPS_PROXY=https://10.158.100.6:8080/"
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
....

您能帮我创建Docker映像的问题是什么。

注意:如果我确实在barhrc中使用相同的代理详细信息进行设置,则可以连接和下载repodata文件。

docker containers yum dnf
1个回答
0
投票

需要通过build args提供代理配置,例如:

docker build \
  --build-arg http_proxy=http://10.158.100.6:8080 \
  --build-arg https_proxy=http://10.158.100.6:8080 \
  ...
© www.soinside.com 2019 - 2024. All rights reserved.