Lookup registry-1.docker.io: no such host

I have a docker daemon running on my Ubuntu 16.4 server

my server data:

No LSB modules available. Distributor ID: Ubuntu Description: Ubuntu 17.04 Release: 17.04 Codename: zesty

I get the following error:

aa@aaa-VirtualBox :/etc/default$ docker run hello-world Unable to find image 'hello-world: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'. 

I set http_proxy and https_proxy beacuse I'm behind the proxy / firewall

Any clues how can I fix this problem?

+12
docker ubuntu
source share
4 answers

You need to set the proxy for the Docker daemon, also using the environment variable. Running Docker also does docker casting because the image does not exist. In your case, the proxy only applies to the docker launch command, which delegates the docker daemon, which works without a proxy.

Create a file called /etc/systemd/system/docker.service.d/10_docker_proxy.conf with the contents below

 [Service] Environment=HTTP_PROXY=http://1.1.1.1:111 Environment=HTTPS_PROXY=http://1.1.1.1:111 

Be sure to update the proxy server according to the one you have 1.1.1.1:111 - this is just an example

Then run the following commands to restart docker

 sudo systemctl daemon-reload sudo systemctl restart docker 

Now use the docker launch command and it should work

+16
source share

What you can try:

a) Add a name server 8.8.8.8

Method number 1

 docker-machine ssh default sudo vi /etc/resolv.conf //change nameserver to 8.8.8.8 

Then restart the server using

 service docker restart 

Note. If you do not have a docker machine installed, you can follow the instructions here to install it. It comes with Windows and Mac, but is available for manual installation on Linux.

Method number 2

Edit /etc/docker/daemon.json or "provide the JSON configuration in the settings panel" with the following information:

 { "dns" : [ "8.8.8.8", "8.8.4.4" ]} 

Then restart the server using

 service docker restart 

b) Configuring a proxy server

Method number 1

Change the proxy server configuration as suggested by Tarun Lalvani.

Edit /etc/default/docker and add:

 export http_proxy='http://username: password@proxy-host :proxy-port' export https_proxy='https://username: password@proxy-host :proxy-port' 

Then restart the server using

 service docker restart 

Method number 2

Source: https://github.com/moby/moby/issues/32270#issuecomment-340709035

  1. Create a system directory for the Docker service:

     mkdir -p /etc/systemd/system/docker.service.d # For HTTP Proxy: vim /etc/systemd/system/docker.service.d/http-proxy.conf # For HTTPS Proxy: vim /etc/systemd/system/docker.service.d/https-proxy.conf 
  2. Then add below the content with the proxy server settings (change it to "HTTPS" for https)

     [Service] Environment="HTTP_PROXY=http://<allowed_proxy_ipv4_address>:<proxy_port_num>/" [Service] 
  3. sudo systemctl daemon-reload

  4. sudo systemctl restart docker
  5. Verify that the configuration has been loaded: systemctl show --property=Environment docker

c) Reinstall Docker

Unfortunately, the last resort may work. Visit these github pages for more suggestions:

For me, setting up a proxy using the systemctl method was the only thing that worked.

+5
source share

I solve the error by changing the DNS server to 8.8.8.8 - Ubuntu 18.04.3 LTS

1- Open Ubuntu System Preferences and go to Network

enter image description here

2- Click the settings button next to the network name in the list to which you are connected.

3- A new window opens with a large number of tabs, one of which has the label "IPv4".

enter image description here

4- After opening the β€œIPv4” tab, you will find the β€œDNS” field. Here you can write a DNS server

enter image description here

If you want to use more than one DNS, you can enter and separate them with a comma.

0
source share

Go to Docker Settings β†’ Proxies β†’ Manual Proxy Settings .

Set the proxy data in the input and apply.

Restart docker. This will solve the problem.

http://19.12.1.40:83

0
source share

All Articles