Not able to download the packages using Docker Build

Viewed 1888

I am creating a docker image using DockerFile. When i execute the docker build command i get an error, below are the details

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]

I have started the docker service, using the HTTP_PROXY

....
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
....

Could you please help me what is the issue to create the Docker Image.

Note: If i do curl with the setting the same proxy details in barshrc, i am able to connect and download the repodata file.

1 Answers

Proxy configuration needs to be provided via build args, e.g.:

docker build \
  --build-arg http_proxy=http://10.158.100.6:8080 \
  --build-arg https_proxy=http://10.158.100.6:8080 \
  ...
Related