Open fenollp opened 3 days ago
Oh I believe I conflated the two concepts of builder
s & context
s.
From this I'm interested in the part that says
This lets you switch the daemon your docker CLI connects to.
How can one use a context to maintain a connection to a remote docker-container
-driver builder?
If you use DOCKER_CONTEXT=tstr docker build
that means tstr
default builder for your context (unless you used buildx use --global
), not the builder instance.
You probably meant BUILDX_BUILDER=tstr
.
If you do have docker context created already on ssh endpoint then you don't need to set the ssh address again on buildx create
, you can use the context name or let it use the active context.
So how does one achieve a persistent ssh connection to a remote docker-container
builder? A conn that stays alive in between multiple docker buildx build
calls, without having to re-establish the con.
Thanks!
https://github.com/docker/buildx/issues/1293 and your advice helped me understand that my command should be
docker buildx create --bootstrap --name oomphy ssh://oomphy --driver=docker-container --driver-opt=image=docker.io/moby/buildkit:buildx-stable-1@sha256:5d410bbb6d22b01fcaead1345936c5e0a0963eb6c3b190e38694e015467640fe
Then I make my build calls with $BUILDX_BUILDER=oomphy
expecting them to connect straight up to my remote host, yet my code consistently waits around 2 seconds for the first logs to appear. I see this with other networked machines as well.
I also observe some wait times reaching 1s with BUILDX_BUILDER=default
and more rarely without any builder, I guess that's more explainable by that I execv buildx on each call.
Is there any way for me to set up some kind of proxy that maintains a conn with my remote builder and basically multiplex it through the local UD socket to my local build calls? Can the docker
daemon be configured to provide this?
Or do you maybe have some code to show?
And no, there's no way around it, my build calls cannot all come at once.
So how does one achieve a persistent ssh connection to a remote docker-container builder? A conn that stays alive in between multiple docker buildx build calls, without having to re-establish the con.
If you wish for your ssh connection to not drop after buildx/docker exist then that is controlled by your SSH config.
Usually smth like
ControlPath ~/.ssh/cm-%r@%h:%p
ControlMaster auto
First google link: https://www.cyberciti.biz/faq/linux-unix-reuse-openssh-connection/
Contributing guidelines
I've found a bug and checked that ...
Description
I would like to create and connect to a
docker-container
builder through SSH (with custom port) or TCP. I use a builder in the hope that it'll negotiate the connection only once, keeping it up until I remove it.I created a builder with this command (
ssh tstr
works on my machine and using this Docker daemon via$DOCKER_HOST=ssh://tstr
works):Expected behaviour
Actual behaviour
Buildx version
github.com/docker/buildx v0.15.1 1c1dbb2
Docker info
Builders list
Configuration
-
Build logs
No response
Additional info
No response