How to use buildctl with localhost registry with tls

885 views Asked by At

Im trying to use buildctl tool with Artifactory registry running on my localhost.

I'm using the following command.

buildctl build \
--frontend=dockerfile.v0 \
--local context=. \
--local dockerfile=. \
--output type=image,name=192.168.0.110:8082/docker-local/test,push=true,registry.insecure=true \
--export-cache type=registry,ref=192.168.0.110:8082/docker-local/test,mode=max,push=true,registry.insecure=true \
--import-cache type=registry,ref=192.168.0.110:8082/docker-local/test,registry.insecure=true 

I added the flag "registry.insecure=true" as stated in the documentation. but, still getting the following error:

> exporting content cache:
------
error: failed to solve: error writing layer blob: failed to do request: Head "https://192.168.0.110:8082/v2/docker-local/test/blobs/sha256:03d1cdba14f373b9dbca6b5fe65f8eca1e9852aaaf9060450b27f924a56a1b3c": remote error: tls: unrecognized name

Seems like it's trying to reach the local repo with HTTPS.

How can I make it work with HTTP?

Using version: buildctl github.com/moby/buildkit 0.11.1

1

There are 1 answers

4
BMitch On BEST ANSWER

The buildkit daemon needs to be run with a configuration file that specifies the registry is http instead of https. See the documentation on buildkitd.toml:

[registry."192.168.0.110:8082"]
  http = true

The file path is /etc/buildkit/buildkitd.toml for rootful mode, ~/.config/buildkit/buildkitd.toml for rootless mode.