Skip to content

cannot build CentOS 8 behind proxy (pull access denied for arhashem/xr-centos) #18

@fcuiller

Description

@fcuiller

Whenever trying to build the package behind a proxy, the appmgr_build fails at step 5:

cisco@telemetry-paris:~/xr-appmgr-build$ sudo ./appmgr_build -b ipmitool/build.yaml
Build version: 46055cab7d8ceff6fd1c3444195761574ac2e146
Starting to build package: ipmitool
---> ipmitool
Building docker image arhashem/xr-centos...
docker build docker -f docker/Centos.Dockerfile -t arhashem/xr-centos
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/
 
Sending build context to Docker daemon  6.656kB
Step 1/6 : FROM centos:8
---> 5d0da3dc9764
Step 2/6 : RUN cd /etc/yum.repos.d/
---> Using cache
---> 02793eb306d3
Step 3/6 : RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
---> Using cache
---> 139182e12559
Step 4/6 : RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
---> Using cache
---> a078099c8f19
Step 5/6 : RUN yum install -y pinentry rpm-sign rpm-build
---> Running in b14087148cef
^@CentOS Linux 8 - AppStream                      0.0  B/s |   0  B     02:00
Errors during downloading metadata for repository 'appstream':
  - Curl error (28): Timeout was reached for http://vault.centos.org/centos/8/AppStream/x86_64/os/repodata/repomd.xml [Connection timed out after 30001 milliseconds]
  - Curl error (28): Timeout was reached for http://vault.centos.org/centos/8/AppStream/x86_64/os/repodata/repomd.xml [Connection timed out after 30000 milliseconds]
Error: Failed to download metadata for repo 'appstream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
The command '/bin/sh -c yum install -y pinentry rpm-sign rpm-build' returned a non-zero code: 1
make: *** [Makefile:7: arhashem/xr-centos] Error 1
Adding sources...
---> ipmitool
Adding configs...
Adding data...
Creating source archive...
^@Generating spec file: ipmitool-1.0.1.spec
Building RPM...
/usr/sbin/build_rpm.sh --spec-file /usr/src/rpm/SPECS/ipmitool-1.0.1.spec --source-dir /root/rpmbuild/SOURCES --rpm-dir /root/rpmbuild/RPMS --output-dir /root/RPMS --verbose
Unable to find image 'arhashem/xr-centos:latest' locally
docker: Error response from daemon: pull access denied for arhashem/xr-centos, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.

The reason is yum configuration must be provided the proxy details.
This can be achieved adding one extra line at the beginning of the Centos.Dockerfile:

cisco@telemetry-paris:~/xr-appmgr-build/docker$ cat Centos.Dockerfile
FROM centos:8
 
# Patching proxy
RUN echo "proxy=[http://proxy-wsa.esl.cisco.com:80](http://proxy-wsa.esl.cisco.com/)" >> /etc/yum.conf <<<<< add this line and replace with correct proxy information.
 
RUN cd /etc/yum.repos.d/
#Comment all the occurences of mirrorlist inside /etc/yum.repos.d/CentOS-* file
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
#Replace all the occurences of mirror basurl with vault baseurl inside /etc/yum.repos.d/CentOS-* file
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
RUN yum install -y pinentry rpm-sign rpm-build
 
COPY build_rpm.sh /usr/sbin/

Thanks @suhaib-ahmd

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions