Mpizos Dimitris
Mpizos Dimitris

Reputation: 4991

Error Connecting to Docker hub

I have created a docker hub account and trying to connect on it to push an image. I am getting the following error:

>>>docker login -u <username> -p <password>

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 run this and i got the following message:

>>>curl https://registry-1.docker.io/v2/
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}

Also:

>>> env | grep -i proxy

gave no result(means that i dont have proxy settings??)

>>> docker version
Client:
Version:      1.12.3
API version:  1.24
Go version:   go1.6.3
Git commit:   6b644ec
Built:        Wed Oct 26 22:01:48 2016
OS/Arch:      linux/amd64

Server:
Version:      1.12.3
API version:  1.24
Go version:   go1.6.3
Git commit:   6b644ec
Built:        Wed Oct 26 22:01:48 2016
OS/Arch:      linux/amd64

Any idea how to overpass that?

Upvotes: 25

Views: 68958

Answers (17)

Homayoon Soleimani
Homayoon Soleimani

Reputation: 5

i solve to this problem with change the dns to 8.8.8.8 and run this commands:

sudo systemctl deamon-reload

sudo systemctl restart docker*

the docker* restart whole docker.

Upvotes: 0

andreas
andreas

Reputation: 1

Define in your host operating system's network configuration a standard gateway for the docker adapter and also one for DNS. This solved the problem for me.

Upvotes: 0

Casper Purtlebaugh
Casper Purtlebaugh

Reputation: 1

There's no proxy in my setup so this was resolved with a simple docker restart. This can be done easily via cli or gui

Upvotes: 0

calycolor
calycolor

Reputation: 736

I just switched from Mac to corporate Windows 10 machine, so getting to the Docker GUI was not obvious, I had to expand the carret ("^"), then right click on Docker icon:

Docker GUI

I chose Settings in the right click menu to bring up the Docker GUI. In the Docker GUI, I clicked on Proxies and added the (actual) address of my company proxy:

Docker Proxy

Also of note, I was able to login to our internal repository and Docker Hub so that I could pull images from both places - so my config.json file looked (something) like this:

{
  "auths": {
    "company.internal.rep.com:9000": {},
    "https://index.docker.io/v1/": {}
  },
  "HttpHeaders": {
    "User-Agent": "Docker-Client/18.09.2 (windows)"
  },
  "credsStore": "wincred"
}

Upvotes: 2

Indrajith Indraprastham
Indrajith Indraprastham

Reputation: 1348

If you are in Linux. You can change nameserver in /etc/resolv.conf. Set the nameserver to 8.8.8.8. Restart the docker demon. sudo systemctl restart docker.

Upvotes: 5

Tayo Amuneke
Tayo Amuneke

Reputation: 11

Open the docker whale icon and restart docker.

Upvotes: 0

Sameer Awate
Sameer Awate

Reputation: 99

In Docker settings -> Network, I switched the DNS Server setting to "Fixed" as in the screenshot below and it worked!

enter image description here

Upvotes: 1

dushyant
dushyant

Reputation: 369

I got the same issue, i just restarted the docker service and it works fine for me

$ sudo service docker restart

$ docker login

Upvotes: 0

i.karayel
i.karayel

Reputation: 4875

I faced the same issue for win 10 pro. After both changes, I was able to log-in and pull images.

  1. If you want to use windows as a container. Right-click docker whale icon and -> switch to windows container.

windows as container

  1. If you want to use Linux as a container. (Your machine must have a password for login)

    • Right-click docker whale icon and -> switch to Linux container.

    • Go to Settings click shared drives and select D or C or both.

    • Enter the windows user password and save changes.

linux as container

Upvotes: 3

gold-kou
gold-kou

Reputation: 305

In my case (Ubuntu 16.04, Docker 18.01.0), I could solve it by setting the proxy like below.

$ sudo mkdir -p /etc/systemd/system/docker.service.d
$ sudo vi /etc/systemd/system/docker.service.d/http_proxy.conf
[Service]
Environment="HTTP_PROXY=http://<your_proxy_ip>:<your_proxy_port>/"
$ sudo vi /etc/systemd/system/docker.service.d/https_proxy.conf
[Service]
Environment="HTTPS_PROXY=http://<your_proxy_ip>:<your_proxy_port>/"
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker

Upvotes: 24

DM_Morpheus
DM_Morpheus

Reputation: 730

Docker 18 / Windows 10:

In Settings > Network > DNS Sever - Select fixed and enter your DNS Server IP.

Upvotes: 1

pme
pme

Reputation: 14803

Mac High Sierra / Docker 18:

In my case I had to sign out my Docker User (directly in the Docker menu).

Upvotes: 2

pvrforpranavvr
pvrforpranavvr

Reputation: 2938

In Linux (Ubuntu)

  • Edit network interface

    nano /etc/network/interfaces
    
  • Replace dns-nameservers some_ip_address to dns-nameservers 8.8.8.8

    dns-nameservers 8.8.8.8
    
  • Restart networking

    sudo systemctl restart networking
    

Note: If google dns (dns-nameservers 8.8.8.8 ) is not working use open dns (dns-nameservers 208.67.222.222)

Upvotes: 0

Ashutosh
Ashutosh

Reputation: 1050

This issue sometimes reoccurs randomly on docker:

If you get this error and are not blocked by a proxy, perform the following steps:

  1. Restart docker-machine

    docker-machine restart default
    
  2. Reset to default env

    eval $(docker-machine env default)
    

If you try again, you may find that everything just works fine.

Upvotes: 7

Sergey V.
Sergey V.

Reputation: 858

I had the same issue. My solution was to specify the correct repository parameter. I've registered at hub.docker.com. So I've added it as parameter to docker login command:

docker login -u username -p password hub.docker.com

If you still have an error, please check that it is not a network issue with your proxy by using the following command:

curl -I -x PROXY_USERID:PROXY_PASSWORD@YOUR_PROXY:PROXY_PORT http://google.com

As well I've used ip address instead of host name to specify my proxy to exclude DNS errors.

If you got error with curl, then you need configure docker http_proxy and https_proxy.

Upvotes: 1

deepak prakash
deepak prakash

Reputation: 723

Modified DNS server setting to 8.8.8.8 and it worked.

enter image description here

Upvotes: 29

Alan
Alan

Reputation: 59

I have the same issue and then resolved the issue by configured the docker environment http_proxy, because i'm behind a corp proxy: https://docs.docker.com/engine/admin/systemd/#http-proxy

Upvotes: 3

Related Questions