Skip to content

TLS trust anchor not recognized for OAuth2 communication #1551

@yoe

Description

@yoe

As of docker 29, doing a "docker pull" to a registry that requires OAuth2 authentication with private TLS certificates no longer works if TLS verification is enabled.

Steps to reproduce:

  1. Run a private registry that requires OAuth2 for authentication with both the registry and the OAuth2 host having TLS certificates under a private CA (e.g., by using the GitLab registry)
  2. Install the private CA for the registry in /etc/docker/certs.d/<registry hostname>/ca.crt
  3. Also install the private CA for the OAuth2 host in /etc/docker/certs.d/<OAuth2 hostname>/ca.crt
  4. docker network create dind
  5. docker volume create dind-certs
  6. docker run -ti --rm --privileged -e DOCKER_TLS_VERIFY=1 -e DOCKER_TLS_CERTDIR=/certs -e DOCKER_CERT_PATH=/certs/client --name docker --network dind -v /etc/docker/certs.d:/etc/docker/certs.d:ro -v dind-certs:/certs docker:dind
  7. docker run -ti --rm -e DOCKER_TLS_VERIFY=1 -e DOCKER_TLS_CERTDIR=/certs -e DOCKER_CERT_PATH=/certs/client --network dind -v /etc/docker/certs.d:/etc/docker/certs.d:ro -v dind-certs:/certs docker:latest docker pull <private registry URL>

Expected result: the image is pulled with no error.

Actual result: Error response from daemon: failed to resolve reference "registry.gitlab.<censored>/<censored>:latest": failed to authorize: failed to fetch anonymous token: Get "https://gitlab.<censored>/jwt/auth?scope=repository%3A<censored>%3Apull&service=container_registry": tls: failed to verify certificate: x509: certificate signed by unknown authority, with a similar message in the container log.

When falling back to docker:28-dind as the image in step 6, the image pull works with no error.

(not sure if this is the right place to report this issue; if not, feel free to redirect)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions