Tuesday, February 28, 2023

How to resolve Error response from daemon docker pull error

 In this video, I am going to show you the root cause of daemon docker pull error and how to resolve it in step by step demo. 



Error:


[root@ ~]# docker pull hello-world

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)


Cause: The above error means that you have setup proxy on your local system and docker is unable to access docker registry through proxy.



Solution: The solution is to set proxy in docker's environment. Following are the steps:


Step 1: Create a drop-in directory 


mkdir /etc/systemd/system/docker.service.d


Step 2: Create a file with name /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable


[Service]

Environment="HTTP_PROXY=URL:8080/"

Environment="HTTPS_PROXY=URL:8080/"

Environment="NO_PROXY= URL,172.10.10.10"


Step 3: Reload the systemd daemon


# systemctl daemon-reload


Step 4: Restart docker


# systemctl restart docker


Step 5: Verify that the configuration has been loaded


# systemctl show docker --property Environment


This should show the value of proxy variables which you set above. 


Step 6: Now run docker pull command again and it should work. 

No comments: