Score:1

Unable to login to docker via Ubuntu 18.04.5 LTS

mx flag

I am having an issue on login to docker from my Ubuntu 18.04.5 LTS

This is the command I run to login docker

sudo docker login -u myname -p mypass

This is the error I've got

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 did searches on google and seems it is not quite a common issue to everyone.

This is my docker version

Client: Docker Engine - Community
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:45:36 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.12
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       48a66213fe
  Built:            Mon Jun 22 15:44:07 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Basically, there are what I have done so far:

  1. run sudo docker run hello-world to verify that my docker is runner properly
Hello from Docker!
This message shows that your installation appears to be working correctly.
...
  1. run sudo vi ~/.docker/config.json to add "HttpHeaders
{
        "auths": {},
        "HttpHeaders": {
                "User-Agent": "Docker-Client/19.03.12 (linux)"
        }
}
  1. run sudo vi /etc/docker/daemon.json to add dns then reload daemon and restar docker
{
                "dns": ["8.8.8.8","8.8.4.4" ]
}
  1. run curl https://registry-1.docker.io/v2/ and sure enough I've got this
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}

As people were talking about proxy server, I also did a test run curl https://google.com aand get respons, does it mean that my server is not reside behind a proxy?

Unfortunately, after try several combinations of above solutions, I'm still not able to login to docker.

Does anyone has any advice?

Vesper avatar
us flag
Most likely you are having issues with connecting to one of the `registry-1.docker.io` addresses while having perfect connection to another. I say use hosts file and lock at least one of the addresses returned by `dig a registry-1.docker.io` for your docker daemon to use, while testing with verbose curl (to get exact IP) that it actually works.
in flag
I am wondering if this is something to do with you running a relatively old build and OS. Did you create an [access token](https://www.techrepublic.com/article/how-to-successfully-log-in-to-dockerhub-from-the-command-line-interface/) to login, or were you trying to use your username+password? Anyway, I would be tempted to run tcpdump with some capture filters to see if you can see the problem.
Scorpioooooon21 avatar
mx flag
Hi, @Zoredache. I have two sets of servers running with exactly the same Ubuntu and Docker. The one residing behind enterprise proxy can perform docker login without any issue. I am currently having issues on the other cluster, which does not reside behind any proxy
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.