docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io: no such host
This tutorial guides you on how to resolve docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io: no such host while running docker run command to find and pull the image from docker hub.
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io: no such host.
I had setup docker in the ubuntu vm and tried to pull guacamole/guacd image to run as docker container. But it resulted in the following error.
$ sudo docker run --name guacd -d guacamole/guacd Unable to find image 'guacamole/guacd:latest' locally docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io: no such host. See 'docker run --help'.
Solution – Setup Docker Proxy
I figured out that, since the docker is setup on development vm which is behind the corporate firewall it is not able to reach host registry-1.docker.io . Therefore, to fix the above docker error follow the below steps to setup Docker Proxy.
1: First, create a new directory called docker.service.d under /etc/systemd/system folder.
2: Next, create a new docker service configuration file under /etc/systemd/system/docker.service.d directory called http-proxy.conf.
$ cd /etc/systemd/system/docker.service.d $ touch http-proxy.conf $ sudo nano http-proxy.conf
3: Add the following contents matching your environment.
[Service] Environment="HTTP_PROXY=http://proxy.hostname:80/" Environment="HTTPS_PROXY=http://proxy.hostname:80/" Environment="NO_PROXY="localhost,127.0.0.1,::1"
After adding contents save and exit the text editor.
4: In order to flush the changes, you need to reload the daemon configuration.
$ sudo systemctl daemon-reload
5: Finally restart Docker to apply the changes.
$ sudo systemctl restart docker
6: To check the docker service status you can run the following command.
$ sudo systemctl status docker
Check Docker Proxy Status
In order to check whether Docker Proxy is setup correctly you can verify using the following command.
$ sudo docker info
The above command displays system wide information regarding the Docker installation. Information displayed includes the kernel version, number of containers and images etc.,. It also prints the following information using which you can verify the docker proxy setup.
--- --- HTTP Proxy: http://proxy.hostname:80/ HTTPS Proxy: http://proxy.hostname:80/ No Proxy: localhost,127.0.0.1,::1 --- ---
That’s it. Now you should be able to pull any image from the docker hub after restarting docker daemon and docker service. And you won’t see docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp : lookup registry-1.docker.io any more.
Hope this article is helpful 🙂
- How to Explore Docker Container’s File System ?
- Docker EXPOSE Port only to the Host on Google Cloud
- Get Docker Container’s IP Address from the Host
- Copy Files between Host and Docker Container
- Install Anthos Service Mesh (Istio) on GKE Kubernetes Cluster ?
- kubectl unable to connect to server: x509: certificate signed by unknown authority
- How to list all Containers running in Kubernetes Pod ?
- List all kafka topics using kafka testclient ?
- Google cloud shell command to get the default PROJECT_ID – GCP
- How to remove an image tag from docker hub ?
- Build a Docker Image with a Dockerfile and Cloud Build in GCP?
- How to create GCP project on Google Cloud Platform
- MariaDB – How to set max_connections permanently ?
- View Kafka messages using kafka testclient ?
- What is ImagePullBackOff status on a Kubernetes pod ?
- List all kafka topics using kafka testclient
- Delete docker repository from the docker hub
- Replication factor: 1 larger than available brokers: 0 – Create Kafka Topic
- Docker: Error response from daemon get https //registry-1.docker.io/v2/
Saved my day. Thank you very much !!!!