Docker - elasticsearch, tls: failed to verify certificate: x509: certificate signed by unknown authority

Hi everyone,

I am using Unbutu (WSL on Window), I was able to install and run docker.

But when I run docker compose up for this yml file:

version: "2.2"

services:

  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
    environment:
      - ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
    ulimits:
      memlock:
        soft: -1
        hard: -1
    ports:
      - ${ES_PORT}:9200

I have this issue:
error pulling image configuration: download failed after attempts=6: tls: failed to verify certificate: x509: certificate signed by unknown authority

I followed same topics at: Certificate Signed by Unknown Authority Docker Error, but nothing worked.

Can any one help please?

What are you using as the $STACK_VERSION?

ELASTIC_PASSWORD=admin123
STACK_VERSION=8.15.3
ES_PORT=127.0.0.1:9200

Well the compose file is correct, it works for me, the problem relies elsewhere. Someone more knowledgeable will come along, good luck!

Please, summarize what you did exactly, so peoiple don’t have to follow the links and find out what you should have done and what you could have missed.

Thanks for reaching,

  1. I followed this post (Error response from daemon: Get https://docker.elastic.co/v2/: x509: certificate signed by unknown authority - #2 by Benli - Elastic Cloud Enterprise (ECE) - Discuss the Elastic Stack). I was create the cert.crt file in this path: \\wsl.localhost\Ubuntu\etc\pki\ca-trust\source\anchors

  2. I realize, the above post was for CentOS, not for Unbutu, so I checked (Docker elastic 6 unknown authority - Elasticsearch - Discuss the Elastic Stack):
    openssl s_client -connect docker.elastic.co:443 | openssl x509 -text
    and here is the result:

  3. I tried these many times:

sudo apt-get update && sudo apt-get install --only-upgrade ca-certificates
sudo systemctl restart docker

If you have any idea, please share.

What does curl gives you from the WSL distribution?

curl -vvv -L https://docker.elastic.co

and which Ubuntu distribution is in the WSL distribution?