Using buildkitd to build an image on OSX via the Go SDK

Hey folks,

I’m looking at trying to use Buildkit’s Go SDK (GitHub - moby/buildkit: concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit) in order to build images on OSX (and Windows in future). However, I can’t figure out how to make this work, and I keep getting failures to check status things due to the gRPC request failing due to various reasons (it doesn’t know the network, name doesn’t resolve, etc). My main efforts have been focusing on getting the Go SDK to talk to buildkitd in a manually spun-up container, however my real preference is to do it without that extra container if possible (the default installation manages it somehow, but I’m not sure how!)

Here’s a summary of what I know:

  • BuildKit works through Docker Desktop, which I assume means it has access to a buildkitd somewhere
  • BuildKit supports running in a Docker container, and buildctl can be pointed to buildkitd running in that container. However, it seems to use a custom connection handling tool to support a docker-container protocol instead of e.g TCP, so I haven’t been able to replicate it. I know the buildkitd in the container is running though, as it is usable via buildctl

Does anyone know how I could get this working? I can’t figure it out to save my life, and documentation seems pretty sparse on the topic