Skip to content

build: clarify remote Bake Git credential scoping - #26443

Merged
crazy-max merged 1 commit into
docker:mainfrom
crazy-max:docs/buildx-3648-bake-git-auth-scoping
Oct 28, 2026
Merged

crazy-max merged 1 commit into
docker:mainfrom
crazy-max:docs/buildx-3648-bake-git-auth-scoping

Conversation

@crazy-max

Copy link
Copy Markdown
Member

Description

Clarifies that Bake reuses HTTP Git credentials from a remote definition for Git build contexts on the same host. Explains that Bake derives the host automatically from the definition URL, so the environment variable names don't take hostname suffixes.

Documents the limits of this credential reuse: contexts on other hosts need separate credentials, and local-only Bake definitions don't receive credentials through these variables.

Related issues or tickets

@crazy-max
crazy-max requested a review from dvdksn as a code owner October 26, 2026 10:58
@netlify

netlify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit 8a5470f
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/6ae1b84c3ec2b457ca7983bb
😎 Deploy Preview https://deploy-preview-26443--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the area/build Relates to Dockerfiles or docker build command label Oct 26, 2026
- [`BUILDX_BAKE_GIT_AUTH_HEADER`](../building/variables.md#buildx_bake_git_auth_header)
- [`BUILDX_BAKE_GIT_SSH`](../building/variables.md#buildx_bake_git_ssh)

For HTTP authentication, Bake derives the host from the remote definition URL

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we keep the detailed explanation in the token reference and shorten this paragraph to:

For HTTP authentication, Bake also uses these credentials for Git build contexts on the same host as the remote definition. Private Git contexts on other hosts need separate credentials. See BUILDX_BAKE_GIT_AUTH_TOKEN for details.

Generated by Codex

but facilitates the pre-flight authentication in Bake when loading the remote Bake file.
Supported values are `bearer` (default) and `basic`.

For builds using a remote Bake definition, Bake also forwards this scheme to

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we shorten this paragraph to avoid repeating the host-selection and variable-naming explanation from the token entry?

Bake also uses this scheme when authenticating Git build contexts on the same host as the remote definition. See BUILDX_BAKE_GIT_AUTH_TOKEN for details.

Generated by Codex

$ export BUILDX_BAKE_GIT_AUTH_TOKEN=$(cat git-token.txt)
```

When you build from a remote Bake definition, Bake also makes the token

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we replace the added paragraphs with the following? This explains the behavior directly, avoids “unsuffixed” and the BuildKit implementation details, and names both variables instead of using “these variables.”

When you build from a remote Bake definition, Bake also uses this token to authenticate Git build contexts on the same host. For example, a definition fetched from https://git.example.com/team/app.git can use the token for a Git context on git.example.com. Private Git contexts on other hosts need separate credentials.

Bake determines which host can use these credentials from the remote definition URL.

When you use only local Bake definition files, these two variables don’t provide credentials for Git build contexts. Configure Git authentication secrets for those contexts instead.

Generated by Codex

The guide only describes Git credentials for fetching Bake definitions.
Explain reuse for same-host Git contexts, automatic host selection, and
the limits when using local definitions or contexts on other hosts.
Keep the detailed explanation in the token reference.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max
crazy-max force-pushed the docs/buildx-3648-bake-git-auth-scoping branch from a87d3f2 to 8a5470f Compare October 28, 2026 08:54
@crazy-max

Copy link
Copy Markdown
Member Author

@dvdksn Made some changes, let me know if that looks good

@crazy-max
crazy-max merged commit 7bc9218 into docker:main Oct 28, 2026
15 checks passed
@crazy-max
crazy-max deleted the docs/buildx-3648-bake-git-auth-scoping branch October 28, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Relates to Dockerfiles or docker build command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants