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 8.8.8.8, 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 “https://registry-1.docker.io/v2/”: 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": ["https://registry-1.docker.io"] to the end of file named C:\Users\${USER_NAME}\.docker\daemon.json and restart docker service on Windows

1 Like

I have the same issue, and it seems as a bug in docker-desktop.
In my case trying to call docker pull of base image first, solves problem

1 Like

it must be either "insecure-registries": ["http://registry-1.docker.io"] or "insecure-registries": ["registry-1.docker.io"]

1 Like