Skip to content

Add more detail on how to add use custom certificate using Rootless #6068

@Arcelone

Description

@Arcelone

Description

Context

GitLab pipeline using the docker executor with moby/buildkit:rootless.
Purpose of the job: build a Docker image and push it to an internal registry.
This registry uses a TLS certificate signed by an internal root CA, and the runner is behind a corporate proxy.

Config

In my before_script section:

  • I echo my certificate in CRT format (-----BEGIN CERTIFICATE----- ...).
  • Then I add:
[registry."project.url.domain"]
  ca=["path/to/my/file.crt"]

to ~/.config/buildkit/buildkitd.toml.

  • I also add auth credentials and proxy settings in ~/.docker/config.json.

I tried adding:

--registry-auth-tlscontext host=project.url.domain,insecure=false,ca=path/to/my/file.crt

I made sure to set no_proxy in the container environment and noProxy in Docker’s config.json so that connections to our local domain are direct.

Yet I always get:

failed to push to project.url ... TLS failed to verify x509: unknown authority

The root cert is installed and working on the host machine where the GitLab runner is running.

Attempts and workarounds

  • If I add registry.insecure=true to:
buildctl-daemonless.sh build \
  ... \
  --output type=image,...,push=true,registry.insecure=true

it works.

  • If I add the following to buildkit.toml:
insecure = true

it also works.

There seem to be many (~15) issues in this repo related to this situation, but with different setups: k8s, GitLab Docker executor, GitLab k8s executor, standalone setups, and of course rootless vs non-rootless.

If anyone has figured out what I’m missing here, help would be much appreciated. 🤗

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions