- 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.
Where you see it
Docker is written in Go, and the text after x509: is Go’s X.509 verification error: a process could not find the issuing certificate authority in the trust store it reads. The words in front name the process, and so the store to fix.
$ 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.
$ 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).
What it means
Go walks the certificate chain from the handshake upwards until it reaches a 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:
- The daemon:
/etc/docker/certs.d/<host>[:port]/(every.crtfile is a root) plus, on Linux, its own machine’s operating system store, never your shell or browser. - Docker Desktop: a Linux VM whose bundle is built at start-up from the host keychain or certificate store plus
~/.docker/certs.d. - Build steps: the base image’s own CA bundle, never the host’s, while BuildKit’s own fetches (
FROM,ADDfrom a URL) use the builder’s store. - The CLI, for a remote daemon:
ca.peminDOCKER_CERT_PATH, by default~/.docker.
Likely causes
The daemon on Linux sits behind a TLS-inspecting proxy
Public registries fail too: a TLS-inspection proxy re-signs every site with its own CA. See who issued what the registry sent:
openssl s_client -showcerts -connect registry.example.com:443 </dev/null 2>/dev/null \
| openssl x509 -noout -subject -issuer
subject=CN=registry.example.com
issuer=CN=Corp Proxy Root CA, O=Example Ltd
If the issuer is your proxy or internal CA, install that root; a public issuer means an incomplete chain instead (check it).
A per-registry directory cannot cover Docker Hub and every mirror, so add the root to the host store and restart the daemon:
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. 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:
{
"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:
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, npm, pip): the step ran with the base image’s bundle. Copy the root in first:
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.
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):
RUN \
NODE_EXTRA_CA_CERTS=/tmp/corp-root.crt npm ci
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:
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain corp-root.pem
Windows, from an elevated 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 and on 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:
[registry."registry.example.com:5000"]
ca = ["/etc/certs/corp-root.pem"]
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:
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:
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 readable only by you; How to set up mutual TLS (nginx and curl) covers issuing them.
Check yours
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
- Certificate chains and path validation
- x509: certificate signed by unknown authority and How to work behind a TLS-inspecting corporate proxy, safely.
- Docker: Verify repository client with certificates, Use CA certificates with Docker, dockerd reference, Desktop FAQs for Mac and Windows, Dockerfile reference, Configure BuildKit, Protect the Docker daemon socket and Test an insecure registry.
Does your team keep hitting this?
Everyone can use the lessons. Team seats add earned credentials, invitations and a completion report, so you see who has finished.
Early edition. Written with AI assistance and checked against primary sources; an independent expert review is planned. Found a mistake? Tell us.