Balaji Krishnan
Balaji Krishnan

Reputation: 457

yum proxy error while creating a docker image

I have a dockerfile that should create a linux image and oracle database and few other things. However running the docker command i get the following error

http://yum.oracle.com/repo/OracleLinux/OL7/UEKR4/x86_64/repodata/repomd.xml:
[Errno 14] curl#5 - "Could not resolve proxy: www-proxy.us.oracle.com;
Unknown error"

I am creating this docker from inside a proxy and the proxy is appropriately setup in the environment and also in the dockerfile. The lines from where i get this error are

yum install zip
yum -y install oracle-database-preinstall-18c

Interestingly, if i remove the yum commands and create a base docker and run the same yum commands from within the container, it works quite well.


# LICENSE UPL 1.0
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.

FROM oraclelinux:7.4

MAINTAINER Temporary Name <[email protected]>

ENV JAVA_PKG=server-jre-8u*-linux-x64.tar.gz \
JAVA_HOME=/usr/java/default \
http_proxy=http://www-myproxy.cn.company.com:80 \
https_proxy=http://www-myproxy.cn.company.com:80 no_proxy=localhost,127.0.0.1,192.168.0.0/16,10.0.0.0/8,.cn.company.com,.companycorp.com,/var/run/docker.sock

RUN yum-config-manager --save --setopt=ol7_UEKR4.skip_if_unavailable=true  && \
yum install zip && \
 yum -y install oracle-database-preinstall-18c

Upvotes: 1

Views: 2924

Answers (1)

Balaji Krishnan
Balaji Krishnan

Reputation: 457

Sorted this out with the help of a friend in my office. The issue was with the build command. I had to use the --network=host flag while 'build'ing docker.

I did the following sudo docker build --build-arg http_proxy=http://www-proxy.cnt.company.com:80 -t oracle:183 .

instead of

sudo docker build --network=host --build-arg http_proxy=http://www-proxy.cnt.company.com:80 -t oracle:183 .

If someone faces a similar issue, please use --network flag to get that sorted.

Thanks

Bala

Upvotes: 3

Related Questions