Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

gateway: add hostname option to NewContainer API #3680

Merged
merged 1 commit into from
Mar 11, 2023

Conversation

jedevc
Copy link
Member

@jedevc jedevc commented Mar 2, 2023

The Meta options struct supports setting the hostname for launching containers, however, it's only used when executing ExecOps. This patch enables setting the hostname for the NewContainer gateway API, instead of just the defaultHostname "buildkitsandbox".

The main use of this is for the debugging feature in buildx, so that the client can set a custom hostname for the --invoked build 馃帀 e.g.:

buildx build $PWD --detach=false --invoke sh --builder=dev
INFO: launching local buildx controller
WARNING: No output specified with remote driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
[+] Building 2.4s (12/12) FINISHED                                                                              remote:dev
 => [internal] load build definition from Dockerfile                                                                  0.0s
 => => transferring dockerfile: 418B                                                                                  0.0s
 => resolve image config for docker.io/docker/dockerfile:1                                                            1.6s
 => [auth] docker/dockerfile:pull token for registry-1.docker.io                                                      0.0s
...
Launching interactive container. Press Ctrl-a-c to switch to monitor console
Interactive container was restarted with process "p1uv38no7xnemyaohn9aous7o". Press Ctrl-a-c to switch to the new container
# bash
root@foo:/# who

where foo is the custom hostname that we could set accordingly in buildx.

The Meta options struct supports setting the hostname for launching
containers, however, it's only used when executing ExecOps. This patch
enables setting the hostname for the NewContainer gateway API, instead
of just the defaultHostname "buildkitsandbox".

Signed-off-by: Justin Chadwell <me@jedevc.com>
@jedevc jedevc requested review from tonistiigi and ktock March 2, 2023 11:28
@tonistiigi tonistiigi merged commit 2fdf992 into moby:master Mar 11, 2023
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.

None yet

3 participants