Skip to content

Reach a builder over ssh or tcp instead of the local vsock - #2190

Closed
MayCXC wants to merge 1 commit into
apple:mainfrom
MayCXC:builder-remote-transport
Closed

Reach a builder over ssh or tcp instead of the local vsock#2190
MayCXC wants to merge 1 commit into
apple:mainfrom
MayCXC:builder-remote-transport

Conversation

@MayCXC

@MayCXC MayCXC commented Aug 27, 2026

Copy link
Copy Markdown

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Closes #2189.

The build command's builder is hardwired to this machine's: the only acquisition dials the local builder's vsock and starts one when the dial fails. A second machine with disk and cycles to spare could hold the builder, but nothing could reach it.

buildkit reaches remote daemons through BUILDKIT_HOST, whose ssh helper executes buildctl dial-stdio on the peer and speaks over the command's standard streams, the ssh channel carrying authentication and encryption with no TLS in the path; tcp reaches a listener directly, where mTLS is the hardening buildkitd documents. https://github.com/moby/buildkit/blob/master/client/connhelper/ssh/ssh.go

builder dial-stdio is that command for this CLI: it proxies the standard streams to the builder's vsock, so a peer needs sshd and this CLI and nothing else. The build command resolves the address from --builder, then the CONTAINER_BUILD_REMOTE environment variable, then build.remote in the configuration, the way buildctl's --addr rides over BUILDKIT_HOST, in the same address grammar: ssh addresses spawn ssh running the peer's dial-stdio with a socketpair end as both of the child's streams, tcp addresses connect directly, and the connection feeds the same Builder the vsock path feeds.

A remote builder's lifecycle is its machine's, so the local start and retry paths stay local.

Complementary to #2188, which publishes the local daemon's socket for a client on the same machine; this is the half that crosses machines and speaks this CLI's own protocol rather than buildkit's.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

A build driven against a second Mac over ssh:// runs on that machine's builder, with the context served from the invoking machine as usual; a tcp:// address reaches a listener directly. With no address configured, the local vsock path is unchanged, including its start-on-failure behaviour.

Integration suite: 397 passed. Unit suite: 772 passed. make fmt, make check clean.

The build command's builder is hardwired to this machine's: the only
acquisition dials the local builder's vsock and starts one when the
dial fails. A second machine with disk and cycles to spare could hold
the builder, but nothing could reach it.

buildkit reaches remote daemons through BUILDKIT_HOST, whose ssh
helper executes buildctl dial-stdio on the peer and speaks over the
command's standard streams, the ssh channel carrying authentication
and encryption with no TLS in the path; tcp reaches a listener
directly, where mTLS is the hardening buildkitd documents.
https://github.com/moby/buildkit/blob/master/client/connhelper/ssh/ssh.go

builder dial-stdio is that command for this CLI: it proxies the
standard streams to the builder's vsock, so a peer needs sshd and this
CLI and nothing else. The build command resolves the address from
--builder, then the CONTAINER_BUILD_REMOTE environment variable, then
build.remote in the configuration, the way buildctl's --addr rides
over BUILDKIT_HOST, in the same address grammar: ssh addresses spawn
ssh running the peer's dial-stdio with a socketpair end as both of the
child's streams, tcp addresses connect directly, and the connection
feeds the same Builder the vsock path feeds. A remote builder's
lifecycle is its machine's, so the local start and retry paths stay
local.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request]: reach a builder on another machine over ssh or tcp

2 participants