CodeWithDanDockerServices icon indicating copy to clipboard operation
CodeWithDanDockerServices copied to clipboard

Unable to run apt-get for mongo image from corporate firewall

Open maheshk172 opened this issue 9 years ago • 5 comments

Hi Dan,

Thanks for good code. I am able to build other images properly but build for mongo image is not working from corporate firewall proxy. Please find below the errors.

Errorrs: _---> Running in 24eb6fa4206e Err http://repo.mongodb.org jessie/mongodb-org/3.4 InRelease

Err http://repo.mongodb.org jessie/mongodb-org/3.4 Release.gpg Unable to connect to repo.mongodb.org:http: ---> 25ea78fb5b0b Err http://deb.debian.org jessie InRelease

Err http://deb.debian.org jessie-updates InRelease

Err http://deb.debian.org jessie Release.gpg Unable to connect to deb.debian.org:http: [IP: 149.20.4.15 80] Err http://deb.debian.org jessie-updates Release.gpg Unable to connect to deb.debian.org:http: [IP: 149.20.4.15 80] Err http://security.debian.org jessie/updates InRelease

Err http://security.debian.org jessie/updates Release.gpg Unable to connect to security.debian.org:http: [IP: 195.20.242.89 80] Removing intermediate container 24eb6fa4206e Step 7/8 : EXPOSE 27017 Reading package lists... ---> Running in 47c172f04e22

---> e36b88f91680 Removing intermediate container 47c172f04e22 Step 8/8 : ENTRYPOINT /mongo_scripts/run.sh W: Failed to fetch http://deb.debian.org/debian/dists/jessie/InRelease

W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/InRelease

W: Failed to fetch http://security.debian.org/dists/jessie/updates/InRelease

W: Failed to fetch http://repo.mongodb.org/apt/debian/dists/jessie/mongodb-org/3.4/InRelease

W: Failed to fetch http://repo.mongodb.org/apt/debian/dists/jessie/mongodb-org/3.4/Release.gpg Unable to connect to repo.mongodb.org:http:

W: Failed to fetch http://deb.debian.org/debian/dists/jessie/Release.gpg Unable to connect to deb.debian.org:http: [IP: 149.20.4.15 80]

W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/Release.gpg Unable to connect to deb.debian.org:http: [IP: 149.20.4.15 80]

W: Failed to fetch http://security.debian.org/dists/jessie/updates/Release.gpg Unable to connect to security.debian.org:http: [IP: 195.20.242.89 80]

W: Some index files failed to download. They have been ignored, or old ones used instead. ---> Running in 9abd7a5c214b Reading package lists... ---> 914a5eed5c5e

Removing intermediate container 9abd7a5c214b Successfully built 914a5eed5c5e Successfully tagged maheshk172/mongo:latest Building redis Building dependency tree... Reading state information... E: Unable to locate package cron E: Unable to locate package netcat-traditional E: Unable to locate package netcat-openbsd Service 'mongo' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y cron netcat-traditional netcat-openbsd' returned a non-zero code: 100_

I tried adding the http_proxy, https_proxy under the mongo.development.env but it did not helped. I also tried adding a /etc/apt/apt.conf file with a proxy configuration and copy them before running apt-get update commands, as suggested on the UBUNTU forums, but it did not helped as well

Could you please help with this issue?

maheshk172 avatar Oct 10 '17 11:10 maheshk172

I'm afraid there isn't anything I can help with on this one since it's related to your firewall blocking access to a site used in the build. You'll need to talk with your network administrators about it to see if they can open access to the site listed in the error.

DanWahlin avatar Oct 11 '17 15:10 DanWahlin

I use Ubuntu on Oracle VirtualBox and I can configure proxy for apt-get in following file /etc/apt/apt.conf But I am not sure how am I suppose to provide the proxy from Docker which will be used when apt-get command will run. I tried copying file at specified location, but it did not helped.

Any suggestions ?

maheshk172 avatar Oct 12 '17 04:10 maheshk172

I haven't had to deal with that personally. I did a little searching and found the following issue that mentions some ENV vars that may help. I don't have a way to test it but hopefully it at least points you in the right direction:

https://github.com/docker/docker-registry/issues/890

You can also check out this doc:

https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables-build-arg

If nothing in those links works, I'd recommend posting the specific info that you show above to stackoverflow.com to see about getting an answer from someone dealing with that.

DanWahlin avatar Oct 12 '17 16:10 DanWahlin

for me, in my Dockerfile, please declare your proxy variable. e.g. for my Dockerfile, I have added in this 2 lines.

ENV https_proxy https://.com:port ENV http_proxy http://.com:port

yptheangel avatar Mar 01 '19 14:03 yptheangel

Not everyone has a proxy to go through so that's not something I can add to the Dockerfile to run every time. However, it'll be good to have your comment in the issues for people to reference. Thanks for sharing.

DanWahlin avatar Mar 01 '19 14:03 DanWahlin