When building a Docker image based on an image in a private repo using a TLS certificate signed with a self-signed CA, everything works fine if that CA is already in the macOS Keychain or in the Windows Trusted Certificate Store – as long as you build using docker build
.
However, when using docker buildx build
the CA is not found and the build fails with a certificate error.
Consider this Dockerfile
:
FROM dockerhub.my.private.mirror.org/oraclelinux:8.6
With docker build
it works fine:
% docker build .
...
=> CACHED [1/1] FROM dockerhub.my.private.mirror.org/oraclelinux:8.6
...
However, using docker buildx build
it fails:
% docker buildx build --load .
...
=> ERROR [internal] load metadata for dockerhub.my.private.mirror.org/oraclelinux:8.6
------
> [internal] load metadata for dockerhub.my.private.mirror.org/oraclelinux:8.6:
------
Dockerfile:1
--------------------
1 | >>> FROM dockerhub.my.private.mirror.org/oraclelinux:8.6
2 |
--------------------
error: failed to solve: dockerhub.my.private.mirror.org/oraclelinux:8.6: ↩
failed to do request: Head "https://dockerhub.my.private.mirror.org/v2/oraclelinux/manifests/8.6": ↩
x509: certificate signed by unknown authority
Does anyone know how to configure docker buildx
to use the private CA certificate on macOS, Windows and Linux?