Unable to login to docker via Ubuntu 18.04.5 LTS

Viewed 240

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?

0 Answers
Related