1

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

igor
  • 716
  • 1
  • 9
  • 27

1 Answers1

2

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.

BMitch
  • 231,797
  • 42
  • 475
  • 450
  • there are no such files on the pod. should i create those? – igor Jan 21 '23 at 20:39
  • @igor probably. It would help to know how you are running buildkitd. – BMitch Jan 22 '23 at 02:15
  • I'm running as specified in the documentation. 1) export BUILDKIT_HOST=docker-container://buildkit 2) docker run --rm --privileged -d --name buildkit moby/buildkit 3) docker login cloudjtrial.jfrog.io 4) buildctl build ... – igor Jan 22 '23 at 08:30
  • Adding the .toml Worked! thanks – igor Jan 22 '23 at 10:00