<!-- https://pkizerotohero.com/errors/docker-x509-unknown-authority/ | Markdown mirror of the HTML page | PKI Zero to Hero, by Duyutech BV -->

> Docker has four trust stores. Find whether the daemon, Docker Desktop's VM, a build step or the CLI rejected the certificate, then fix that one.

Source: https://pkizerotohero.com/errors/docker-x509-unknown-authority/ · Last reviewed: 2026-10-24

- Docker

# Docker: x509: certificate signed by unknown authority

Also seen in: docker login, docker pull, docker build, docker compose, Docker Desktop, BuildKit

**In one sentence:**

The words before x509 say which of Docker's four trust stores rejected the certificate: the daemon, Docker Desktop's VM, a build step's base image or the CLI.

[Check yours: Chain checker](https://pkizerotohero.com/tools/chain/)

## Where you see it

Docker is written in Go, and the text after `x509:` is Go’s [X.509](https://pkizerotohero.com/handbook/glossary/#x509) verification error: a process could not find the issuing [certificate authority](https://pkizerotohero.com/handbook/glossary/#certificate-authority) in the [trust store](https://pkizerotohero.com/handbook/glossary/#trust-store) it reads. The words in front name the process, and so the store to fix.

```text
$ docker pull registry.example.com/app:latest
Error response from daemon: Get "https://registry.example.com/v2/": x509: certificate signed by unknown authority
```

`Error response from daemon`: the daemon made the connection, as it does for `docker pull`, `docker push`, `docker login` and `docker compose pull`.

```text
$ docker ps
error during connect: Get "https://build-host:2376/v1.53/containers/json": x509: certificate signed by unknown authority
```

`error during connect`: the CLI itself could not verify the daemon. kubectl, Helm and Terraform print the bare Go string ([its own page](https://pkizerotohero.com/errors/go-x509-unknown-authority/)).

## What it means

Go walks the [certificate chain](https://pkizerotohero.com/handbook/glossary/#certificate-chain) from the [handshake](https://pkizerotohero.com/handbook/glossary/#tls-handshake) upwards until it reaches a [root certificate](https://pkizerotohero.com/handbook/glossary/#root-certificate) it already holds, and rejects the connection when there is none. Docker has four stores; a root in the wrong one changes nothing:

1. **The daemon**: `/etc/docker/certs.d/<host>[:port]/` (every `.crt` file is a root) plus, on Linux, its own machine’s operating system store, never your shell or browser.
2. **Docker Desktop**: a Linux VM whose bundle is built at start-up from the host keychain or certificate store plus `~/.docker/certs.d`.
3. **Build steps**: the base image’s own CA bundle, never the host’s, while BuildKit’s own fetches (`FROM`, `ADD` from a URL) use the builder’s store.
4. **The CLI**, for a remote daemon: `ca.pem` in `DOCKER_CERT_PATH`, by default `~/.docker`.

## Likely causes

### The daemon on Linux sits behind a TLS-inspecting proxy

Public registries fail too: a [TLS-inspection](https://pkizerotohero.com/handbook/glossary/#tls-inspection) proxy re-signs every site with its own CA. See who issued what the registry sent:

```bash
openssl s_client -showcerts -connect registry.example.com:443 </dev/null 2>/dev/null \
  | openssl x509 -noout -subject -issuer
```

```text
subject=CN=registry.example.com
issuer=CN=Corp Proxy Root CA, O=Example Ltd
```

If the [issuer](https://pkizerotohero.com/handbook/glossary/#issuer) is your proxy or internal CA, install that root; a public issuer means an incomplete chain instead ([check it](https://pkizerotohero.com/guides/check-remote-certificate-chain/)).

A per-registry directory cannot cover Docker Hub and every mirror, so add the root to the host store and restart the daemon:

```bash
sudo cp corp-root.pem /usr/local/share/ca-certificates/corp-root.crt
sudo update-ca-certificates
sudo systemctl restart docker
```

Other distributions: [How to trust a private root CA on Linux](https://pkizerotohero.com/guides/add-root-ca-linux/). The daemon must also know the proxy exists, through the `proxies` block in `/etc/docker/daemon.json` (understood since Docker Engine 23.0.0, released February 2023); restart it after editing:

```json
{
  "proxies": {
    "http-proxy": "http://proxy.example.com:3128",
    "https-proxy": "http://proxy.example.com:3128",
    "no-proxy": "localhost,127.0.0.0/8,.example.com"
  }
}
```

### One private registry uses a company CA

Only one host fails, and its issuer is your internal CA. Put that root, as PEM, where the daemon looks for the host:

```bash
sudo mkdir -p /etc/docker/certs.d/registry.example.com:5000
sudo cp corp-root.pem /etc/docker/certs.d/registry.example.com:5000/ca.crt
docker pull registry.example.com:5000/app:latest
```

Match the image reference’s host and port (none for 443); the daemon reads the directory on each connection, so no restart is needed. Rootless Docker reads `$XDG_CONFIG_HOME/docker/certs.d` instead. `Missing key ... for client certificate` means a CA file was named `.cert` instead of `.crt`.

`docker login` and `docker compose` use the daemon’s store too; nothing in `~/.docker/config.json` affects trust. If `certs.d` is right but the token URL fails under the containerd image store, check the Engine version: Docker Engine 29.5.0 fixed auth token requests ignoring per-host TLS settings (custom CAs, insecure-registries) under the containerd image store (moby/moby#52600).

### A RUN step in docker build uses the image’s own bundle

`docker pull` works but `RUN apt-get update`, `pip install` or `npm ci` fails with the tool’s own message ([curl](https://pkizerotohero.com/errors/curl-unable-to-get-local-issuer-certificate/), [npm](https://pkizerotohero.com/errors/npm-unable-to-get-issuer-cert-locally/), [pip](https://pkizerotohero.com/errors/python-certificate-verify-failed/)): the step ran with the base image’s bundle. Copy the root in first:

```dockerfile
FROM debian:bookworm
RUN apt-get update && apt-get install -y ca-certificates
COPY corp-root.crt /usr/local/share/ca-certificates/corp-root.crt
RUN update-ca-certificates
```

Install `ca-certificates` first, since it provides `update-ca-certificates`. Most programs then read the rebuilt bundle; pip has too since pip 24.2, through the truststore package (older pip needs `PIP_CERT`), and Node needs `NODE_EXTRA_CA_CERTS`: see [How to make Python, Node.js and npm trust a private CA](https://pkizerotohero.com/guides/trust-ca-python-node/).

For images that leave your organisation, use a build secret so the root never lands in a layer; it exists only during that instruction (a build secret is mounted at /run/secrets/<id> with mode 0400 unless target or mode is set):

```dockerfile
RUN --mount=type=secret,id=corp-root,target=/tmp/corp-root.crt \
    NODE_EXTRA_CA_CERTS=/tmp/corp-root.crt npm ci
```

```bash
docker build --secret id=corp-root,src=./corp-root.crt .
```

### Docker Desktop’s VM does not have the root

On macOS or Windows, `docker context show` prints Desktop’s own context, `desktop-linux`, and the daemon lives in the VM. Trust the root on the host and restart Docker Desktop. macOS:

```bash
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain corp-root.pem
```

Windows, from an elevated PowerShell:

```powershell
certutil -addstore Root corp-root.cer
```

For one registry, `~/.docker/certs.d/registry.example.com/ca.crt` on the host works instead (on Windows, use the certificate store for a registry on another port). Restart Desktop either way: both happen at start-up. See [How to trust a private root CA on macOS](https://pkizerotohero.com/guides/add-root-ca-macos/) and [on Windows](https://pkizerotohero.com/guides/add-root-ca-windows/).

### A docker-container builder fetches with its own store

`FROM` or `ADD https://…` fails while `RUN` steps pass, and `docker buildx inspect` shows `Driver: docker-container`. Give buildkitd the CA in its own configuration:

```ini
[registry."registry.example.com:5000"]
  ca = ["/etc/certs/corp-root.pem"]
```

```bash
docker buildx create --name corp --driver docker-container \
  --buildkitd-config buildkitd.toml --use
```

Buildx copies the file into the builder container.

### The CLI cannot verify a remote daemon

`error during connect`: the `ca.pem` the CLI uses did not sign the daemon’s server certificate. Compare the two:

```bash
openssl s_client -connect build-host.example.com:2376 </dev/null 2>/dev/null | openssl x509 -noout -issuer
openssl x509 -in ~/.docker/ca.pem -noout -subject
```

Point the CLI at the right CA:

```bash
export DOCKER_HOST=tcp://build-host.example.com:2376
export DOCKER_TLS_VERIFY=1
export DOCKER_CERT_PATH=~/.docker/build-host
docker version
```

The directory holds `ca.pem`, `cert.pem` and `key.pem`, the [private key](https://pkizerotohero.com/handbook/glossary/#private-key) readable only by you; [How to set up mutual TLS (nginx and curl)](https://pkizerotohero.com/guides/mutual-tls-setup/) covers issuing them.

Warning

Why insecure-registries is a trap

`"insecure-registries"` in `daemon.json` allows what Docker’s daemon reference calls un-encrypted and/or untrusted communication: the daemon accepts a certificate it cannot verify, and falls back to plain HTTP when HTTPS is unavailable. A [man-in-the-middle](https://pkizerotohero.com/handbook/glossary/#man-in-the-middle) can then serve a replaced image, and `docker login` credentials can travel unencrypted. Docker Desktop also stops sending client certificates to it, breaking [mutual TLS](https://pkizerotohero.com/handbook/glossary/#mutual-tls) outright. The default list is tiny: only registries whose address falls in 127.0.0.0/8 are treated as insecure by default. Docker’s own advice is to add the CA instead; a throwaway local registry is the one exception.

## Check yours

*Interactive tool: Chain checker (runs in the browser at [/tools/chain/](https://pkizerotohero.com/tools/chain/))*

Paste the certificates from `openssl s_client -showcerts`. The checker names the root the chain ends in and flags known HTTPS-inspection products.

## Learn why

- [Who do we trust? CAs, trust stores and self-signed certificates](https://pkizerotohero.com/handbook/trust-stores/)
- [Certificate chains and path validation](https://pkizerotohero.com/handbook/certificate-chains/)
- [x509: certificate signed by unknown authority](https://pkizerotohero.com/errors/go-x509-unknown-authority/) and [How to work behind a TLS-inspecting corporate proxy, safely](https://pkizerotohero.com/guides/corporate-proxy-certificates/).
- Docker: [Verify repository client with certificates](https://docs.docker.com/engine/security/certificates/), [Use CA certificates with Docker](https://docs.docker.com/engine/network/ca-certs/), [dockerd reference](https://docs.docker.com/reference/cli/dockerd/), [Desktop FAQs for Mac](https://docs.docker.com/desktop/troubleshoot-and-support/faqs/macfaqs/) and [Windows](https://docs.docker.com/desktop/troubleshoot-and-support/faqs/windowsfaqs/), [Dockerfile reference](https://docs.docker.com/reference/dockerfile/), [Configure BuildKit](https://docs.docker.com/build/buildkit/configure/), [Protect the Docker daemon socket](https://docs.docker.com/engine/security/protect-access/) and [Test an insecure registry](https://distribution.github.io/distribution/about/insecure/).

**Early edition.** Written with AI assistance and checked against primary sources; an independent expert review is planned. Found a mistake? [Tell us](https://pkizerotohero.com/contact/?topic=content-error&page=/errors/docker-x509-unknown-authority/).

Last reviewed 24 October 2026Edition 0.9

## Learn why it happens

- [Chapter 12: Who do we trust? CAs, trust stores and self-signed certificates](https://pkizerotohero.com/handbook/trust-stores/)
- [Chapter 13: Certificate chains and path validation](https://pkizerotohero.com/handbook/certificate-chains/)

## Everything on this topic

- [Chains and trust stores](https://pkizerotohero.com/topics/chains-and-trust/)
