Cannot login to Docker desktop M1 mac

So recently I have been experiencing an error while logging into my docker-desktop so I tried logging into my docker-desktop of my Mac m1 through CLI cmd and the desktop but still, I am not able to log in to it. I tried using the cmd

docker login -u username -p password 

but still i am getting an error here’s the error log
**Error response from daemon: Get "https://registry-1.docker.io/v2/": dialing registry-1.docker.io:443 with direct connection: connecting to 54.196.99.49:443: dial tcp 54.196.99.49:443: connect: network is unreachable**

Any ideas? how can i resolve these error

No, you log in to Docker Hub (registry), not Docker Desktop. That is just a virtual machine + GUI + some features.

You have a network issue. Run the following on Mac:

curl -vvv --head https://registry-1.docker.io/v2/

If it can connect, then something could be in your network which doesn’t work with the internal network of Docker Desktop.

Hii @rimelek i am getting these output after running the above cmd

 curl -vvv --head https://registry-1.docker.io/v2/
*   Trying [2600:1f18:2148:bc01:20a3:9c3e:d4a7:9fb]:443...
*   Trying 34.226.69.105:443...
* Connected to registry-1.docker.io (2600:1f18:2148:bc01:20a3:9c3e:d4a7:9fb) port 443
* ALPN: curl offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-AES128-GCM-SHA256
* ALPN: server did not agree on a protocol. Uses default.
* Server certificate:
*  subject: CN=*.docker.com
*  start date: Oct  2 00:00:00 2023 GMT
*  expire date: Oct 31 23:59:59 2024 GMT
*  subjectAltName: host "registry-1.docker.io" matched cert's "*.docker.io"
*  issuer: C=US; O=Amazon; CN=Amazon RSA 2048 M01
*  SSL certificate verify ok.
* using HTTP/1.x
> HEAD /v2/ HTTP/1.1
> Host: registry-1.docker.io
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 401 Unauthorized
HTTP/1.1 401 Unauthorized
< content-type: application/json
content-type: application/json
< docker-distribution-api-version: registry/2.0
docker-distribution-api-version: registry/2.0
< www-authenticate: Bearer realm="https://auth.docker.io/token",service="registry.docker.io"
www-authenticate: Bearer realm="https://auth.docker.io/token",service="registry.docker.io"
< date: Thu, 25 Jan 2024 20:30:53 GMT
date: Thu, 25 Jan 2024 20:30:53 GMT
< content-length: 87
content-length: 87
< strict-transport-security: max-age=31536000
strict-transport-security: max-age=31536000

<
* Connection #0 to host registry-1.docker.io left intact

any ideas how can i resolve these issue ?

Not really. I could never help with these Docker Desktop network issues honestly. I tried to reproduce the issue for an hour, but I failed. There were many similar network issue son this forum. You could try to search for the error message “network is unreachable” in the Docker Desktop categories, escpecially in the Docker Desktop for Mac category to find one where it was solved.

In general, proxies, VPNs could cause these, but in case of Docker Desktop, I’m not sure. I even chose the same network in the Docker Desktop settings as I have on the host, which would make it impossible to communicate with the host, but the docker pull command still worked.

You could try to completely reinstall Docker Desktop and don’t forget to delete $HOME/.docker either.

Hii @rimelek the issue has been solved i tried using Cloudflare for mac macOS desktop client · Cloudflare WARP client docs followed the instructions and the tried Logging using

docker login -u username -p password 

and then it proceed and connected my docker-desktop with my docker-hub and finally the issue is been resolved. Thank you for your time and support.