Tls: failed to verify certificate: x509

Hello, I’m running WSL2 on Windows10 and I have installed Docker Engine on Ubuntu (Jammy 22.0.4) following the guide on Docker site

When I try to verify that the Docker Engine installation is successful by running the hello-world image

$ sudo docker run hello-world

I received this error

Unable to find image ‘hello-world:latest’ locally
docker: Error response from daemon: Get “https://registry-1.docker.io/v2/”: tls: failed to verify certificate: x509: certificate signed by unknown authority.
See ‘docker run --help’.

And the same if I try to run other docker images, like Kafka +Zookeper

docker-compose up -d

I get

Pulling zookeeper (confluentinc/cp-zookeeper:latest)…
ERROR: Get “https://registry-1.docker.io/v2/”: tls: failed to verify certificate: x509: certificate signed by unknown authority

I have tried with my own network and with the company’s one, with and without VPN.

Could you help me? Thanks

How did you install the Docker Engine exactly?

What do you get when you run the following command?

curl -vvvv https://registry-1.docker.io

you can check the certificate this way:

openssl s_client -showcerts -connect registry-1.docker.io:443 </dev/null

Please use code blocks as described here: How to format your forum posts

You can also check if you have an antivirus on the host. Recently I found out that the ESET antivirus can replace the original certificates with its own cert and cause issues in command line while web browsers accept it.