1

How can I fix this problem in Ubuntu 20.04?

[18:31:29] (dpcc) jalal@echo:~/research/code$ sudo docker pull docurdt/heal
[sudo] password for jalal: 
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)


$ uname -a
Linux echo 5.4.0-99-generic #112-Ubuntu SMP Thu Feb 3 13:50:55 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux


$ docker --version
Docker version 20.10.7, build 20.10.7-0ubuntu5~20.04.2

I don't have a problem with this $ docker pull on CentOS 7.

Here are the proxy I have used in ~/.bashrc:

export http_proxy="http://webproxy.bu.edu:8900"
export https_proxy="http://webproxy.bu.edu:8900"
export ftp_proxy="http://webproxy.bu.edu:8900"
export rsync_proxy=$http_proxy
export no_proxy="localhost,127.0.0.1,.bu.edu,.ad.bu.edu,128.197.,10."

Added these in config.json but the error still persist after logout:

$ cat ~/.docker/config.json 
{
 "proxies":
 {
   "default":
   {
     "httpProxy": "http://webproxy.bu.edu:8900",
     "httpsProxy": "http://webproxy.bu.edu:8900",
     "noProxy": "localhost,127.0.0.1,.bu.edu,.ad.bu.edu,128.197.,10."
   }
 }
}

I get:

[19:38:02] jalal@echo:~/research/code$ docker pull docurdt/heal
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
0

4 Answers 4

2

This is my /etc/systemd/system/docker.service.d/http-proxy.conf after docker installation:

[Service]
Environment="HTTP_PROXY=http://my.proxy.address:8080/"

I added HTTPS_PROXY variable which fixed connection issue:

[Service]
Environment="HTTP_PROXY=http://my.proxy.address:8080/"
Environment="HTTPS_PROXY=http://my.proxy.address:8080/"

Thus in your case it might be:

[Service]
Environment="HTTP_PROXY=http://webproxy.bu.edu:8900/"
Environment="HTTPS_PROXY=http://webproxy.bu.edu:8900/"
1
$ sudo mkdir -p /etc/systemd/system/docker.service.d

$ sudo vi /etc/systemd/system/docker.service.d/http-proxy.conf

$ sudo systemctl daemon-reload

$ sudo  systemctl restart docker


$ docker pull docurdt/heal
Using default tag: latest
latest: Pulling from docurdt/heal
e79bb959ec00: Pull complete 
7dc808d5d247: Pull complete 
04e0dd83f1c1: Pull complete 
7680ea831bfd: Pull complete 
f861c2ba948a: Pull complete 
27ae46f94ae6: Pull complete 
92a8fc1df4e5: Pull complete 
d6ff073d4a06: Pull complete 
626ee3046583: Pull complete 
Digest: sha256:31f30cf69b3271fffcba4c439ee19c92587969cd74ec649ec72dec84ce177b86
Status: Downloaded newer image for docurdt/heal:latest
docker.io/docurdt/heal:latest

This is what I have in http-proxy.conf:

$ cat /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://webproxy.bu.edu:8900"
Environment="HTTPS_PROXY="http://webproxy.bu.edu:8900"

Thanks a lot to twainwek from IRC for his time and also sharing this link with me https://github.com/docker/for-win/issues/1534#issuecomment-405903684

1
  • 1
    Adding to mona's answer (I don't have enough reputation to comment), chances are your docker unit file is in a different path. Check with systemctl cat docker | head -1. Feb 1 at 16:35
0

Steps:

  1. Remove the resolvconf package and manage /etc/resolv.conf manually
    sudo apt purge resolvconf
  2. Delete /etc/resolv.conf sudo rm /etc/resolv.conf
  3. Create the file if not exist
    touch /etc/resolv.conf
  4. Edit the file: nano /etc/resolv.conf and add the following:
    nameserver 8.8.4.4
    nameserver 8.8.8.8
  5. That's it. Now, you can pull your docker.
0

I was getting the same error. I am using a ubuntu 20.04 system

Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

I added the missing lines inside /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4
sudo nano /etc/resolv.conf

This is how it looks now.

nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 127.0.0.53
options edns0 trust-ad

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .