Error: server gave HTTP response to HTTPS client

I have been pulling my hair out trying to resolve this issue.
I am using Ubuntu via WSL2 on Windows 10 Pro. I have also tried the same just using elevated privileges on Powershell, with no luck. I am at home without a proxy in India. Doing a docker -v in WSL2 reveals I am using Docker version 20.10.6, build 370c289.

I am using Docker Desktop v. 4.5.1 (74721) from Windows 10 Pro 20H2 x64. I am doing a simple docker login and I get this error. I have tried setting my DNS to, tried setting insecure-registries to localhost:5000, set buildkit to false. I have restarted docker desktop, tried docker logout and then docker login, and nothing works.

The full error message is:
Error response from daemon: Get “”: http: server gave HTTP response to HTTPS client

Whether I am logged into Docker Desktop itself with my docker hub userid and password, or logging in with docker login, I get this problem.

Does anyone have any ideas?

try to add "insecure-registries": [""] to the end of file named C:\Users\${USER_NAME}\.docker\daemon.json and restart docker service on Windows