This error encountered due to the destination unreachability problem. It means that the port might be filtered by the local or external firewall or as another answer, the DNS setting of the machine might be the trouble.
Therefore, make sure you're connecting to the indeed destination. My problem was the firewall of the service provider that I got the server, after I created a ssh tunnel, I've logged in as local.
Follow the procedure to check what's the problem.
$ sudo docker login -u mrt https://gitlab.mydomain.com:5050
Error response from daemon: Get https://gitlab.mydomain.com:5050: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Check the connection:
$ nmap -p 5050 gitlab.mydomain.com
Starting Nmap 7.80 ( https://nmap.org ) at 2020-10-12 14:15 +0330
Nmap scan report for gitlab.mydomain.com (x.x.x.x)
Host is up (0.057s latency).
rDNS record for x.x.x.x: x.x.x.x
PORT STATE SERVICE
5050/tcp filtered mmcc
Nmap done: 1 IP address (1 host up) scanned in 0.27 seconds
Create an ssh tunnel:
$ ssh -p 26 -L 5050:gitlab.mydomain.com:5050 [email protected]
Then:
$ sudo docker login -u mrt https://localhost:5050
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
http
instead ofhttps
the library probably doesn't trust the certificate. @AbhayChowdary – Rhetor