Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker failed to fetch http://deb.debian.org/debian/dists/jessie/InRelease [closed]

Tags:

docker

debian

I found some weird issue when trying to build my docker image in my house, although I am not sure if it's correlated to browser or just a network issue.

So here's what I got. I tried to run this command in my Dockerfile.

RUN apt-get update -qq && \
    apt-get install -y build-essential \
        libpq-dev \
        postgresql-client

After waiting for a moment, somewhat the process output something like this.

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://deb.debian.org/debian/dists/jessie/Release.gpg  Temporary failure resolving 'deb.debian.org'

W: Failed to fetch http://security.debian.org/dists/jessie/updates/Release.gpg  Temporary failure resolving 'security.debian.org'

W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/Release.gpg  Temporary failure resolving 'deb.debian.org'

W: Some index files failed to download. They have been ignored, or old ones used instead.

The weird thing is that, if I tried this in my office network, this does not happen. And then if I tried tethering to my cellphone data network, this also does not happen.

I tried opening http://deb.debian.org/debian/dists/jessie/InRelease in browser, it shows 404. I tried using Tor browser via several networks, it also shows 404.

The docker image is based on ruby:2.3.1.

UPDATE

I tried to use the DNS provided by my house provider 203.142.82.222.

sudo docker run --dns 203.142.82.222 busybox nslookup google.com

This resolves

Server:    203.142.82.222
Address 1: 203.142.82.222 dns-cache1.biz.net.id

Name:      google.com
Address 1: 2404:6800:4003:808::200e sin10s07-in-x0e.1e100.net
Address 2: 117.102.117.245
Address 3: 117.102.117.251
Address 4: 117.102.117.212

But then I changed to /etc/default/docker file and added this.

DOCKER_OPTS="--dns 203.142.82.222 --dns 203.142.84.222"

After I restarted the docker sudo service docker restart, I tried again but it's still not working.

sudo service docker restart
sudo docker run busybox nslookup google.com
Server:    8.8.8.8
Address 1: 8.8.8.8

nslookup: can't resolve 'google.com'
like image 734
Petra Barus Avatar asked May 19 '17 23:05

Petra Barus


2 Answers

I just dealt with this issue building the cartoza/postgis image, that stems from debian:stable. This happens because some popular public DNS are not reachable from this network, e.g.:

$ nslookup duckduckgo.com 8.8.8.8
;; connection timed out; no servers could be reached

Possibly the simplest way around this is to directly instruct Docker to use the DNS available to the network. Start by verifying their addresses:

$ nmcli dev show | grep 'IP4.DNS'
IP4.DNS[1]:                             10.91.3.31
IP4.DNS[2]:                             10.90.3.31
IP4.DNS[3]:                             10.90.7.14

Add them to a new configuration file called daemon.json:

$ sudo pico /etc/docker/daemon.json

And insert the following:

{
    "dns": ["10.91.3.31", "10.90.3.31", "10.90.7.14"]
}

Then restart the service:

$ sudo service docker restart
like image 154
Luís de Sousa Avatar answered Nov 15 '22 19:11

Luís de Sousa


One reason could be that your proxy is not set in Docker file, add these 2 lines in Dockerfile:

ENV http_proxy "http://www-proxy.x.com:80"
ENV https_proxy "http://www-proxy.x.com:80"

Please, update your proxy there. And don't write

ENV HTTP_PROXY "http://www-proxy.x.com:80"

because the env variable is the case sensitive

like image 29
Vicky Gupta Avatar answered Nov 15 '22 17:11

Vicky Gupta