Reputation: 10304
I have docker daemon running on my Ubuntu 16.4 server
my server details:
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 17.04 Release: 17.04 Codename: zesty
I'm receiving 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 have set the http_proxy and the https_proxy beacuse i'm behind a corp proxy/firewall
Any clues how I can fix this issue?
Upvotes: 45
Views: 160619
Reputation: 1406
For folks using colima, i just had to restart colima service
colima stop && colima start
Upvotes: 1
Reputation: 617
I "fixed" it by using another image's tag. In my case I got the same error for java:11-jre, but when I use java:11, everything is work fine. So, just try another tag
Upvotes: 0
Reputation: 574
For windows going to resources > Network and changing DNS to 8.8.8.8 did the trick. Also make sure to restart after changing.
Upvotes: 1
Reputation: 1
In my case, I had a bad config entry in /etc/nsswitch.conf
that prevented docker from resolving container registries.
In /etc/nsswitch.conf
, my hosts line looked like this:
hosts: files myhostname
After changing the hosts property to default value, everything worked.
# default value for hosts
hosts: files myhostname mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns
After changing the /etc/nsswitch.conf
file, make sure to restart systemd-resolved.service
.
Upvotes: 0
Reputation: 3127
Had a similar problem in Docker Desktop for windows, running on top of WSL2 behind a corporate proxy.
After trying the above solutions without no success, the problem was resolved by adding *.docker.com to the Proxy bypass.
Upvotes: 0
Reputation: 4243
I tried many of the above answers, but to no avail.
Finally, this approach worked for me:
docker logout
docker login
I have no idea why though.
Upvotes: 6
Reputation: 574
Simplified detailed solution in case you are having this problem in windows is as below: right click on network open network and internet setting In advanced network setting, click on change adapter options right click on your network or wifi connection click on properties in Networking tab click on Internet protocal version 4 (TCP/IPv4) or ipv6 In general, click on use the following DNS server address and add 8.8.8.8 on preferred DNS server
Upvotes: 1
Reputation: 441
I bumped into this error and was able to resolve by a simple restart:
sudo service docker restart
Upvotes: 13
Reputation: 561
Go to Docker Settings -> Proxies -> Manual proxy configuration.
Set the proxy details in the input and apply.
Restart the docker. This will fix the issue.
Upvotes: 2
Reputation: 480
I solve the error changing DNS server by 8.8.8.8 - Ubuntu 18.04.3 LTS
1- Open the Ubuntu System Settings and Navigate to Network
2- Click the on the setting button next to the Network name in the list to which you are connected.
3- New Window will open with a lot number of tabs, with one of them with the label of “IPv4”.
4- Upon opening the “IPv4” Tab you will find a Field of “DNS”. Here you can write the DNS server
If you want to use more than one DNS, then you can enter and separate them with a comma.
Upvotes: 5
Reputation: 48218
Things you can try:
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 don't have docker-machine installed, you can follow instructions here to install it. It comes with Windows and Mac but is available for install on Linux manually.
Edit /etc/docker/daemon.json Or "provide a JSON configuration in the preference panel" with the following information:
{ "dns" : [ "8.8.8.8", "8.8.4.4" ]}
Then restart the server using
service docker restart
Edit your proxy configuration as Tarun Lalwani suggested.
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
Source: https://github.com/moby/moby/issues/32270#issuecomment-340709035
Create a systemd drop-in 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
Then add below content with proxy settings with it (Change to "HTTPS" for https)
[Service]
Environment="HTTP_PROXY=http://<allowed_proxy_ipv4_address>:<proxy_port_num>/"
[Service]
sudo systemctl daemon-reload
sudo systemctl restart docker
systemctl show --property=Environment docker
Unfortunately the last resort, could work. Check out these github pages for more suggestions:
For me, setting up the proxy using the systemctl method was the only thing that worked.
Upvotes: 22
Reputation: 146510
You need to set the proxy for Docker daemon also using environment variable. Docker run is also doing docker pull since the image doesn't exists. In your case the proxy is only applied to the docker run command, which delegates to the docker daemon which is running without proxy.
Create a file named /etc/systemd/system/docker.service.d/10_docker_proxy.conf
with below content
[Service]
Environment=HTTP_PROXY=http://1.1.1.1:111
Environment=HTTPS_PROXY=http://1.1.1.1:111
Make sure to update the proxy as per the ones you have
1.1.1.1:111
is just an example
Then execute below commands to restart docker
sudo systemctl daemon-reload
sudo systemctl restart docker
Now use your docker run command and it should work
Upvotes: 50