Skip to content

Commit 7c5f051

Browse files
committed
build: document URL queries
BuildKit v0.24 introduces URL like `https://github.com/example/example.git?tag=v0.0.1&checksum=deadbeef` See moby/buildkit PR 6172 Signed-off-by: Akihiro Suda <[email protected]>
1 parent 4c152f3 commit 7c5f051

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

content/manuals/build/concepts/context.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,33 @@ docker build github.com/docker/buildx#d4f088e689b41353d74f1a0bfcd6d7c0b213aed2
245245
docker build github.com/docker/buildx#d4f088e
246246
```
247247

248+
### URL queries
249+
Starting with Buildx v0.28 and BuildKit v0.24, URL queries are also supported.
250+
URL queries are more structured and recommended over [URL fragments](#url-fragments).
251+
252+
For example,
253+
```console
254+
$ docker buildx build https://github.com/user/myrepo.git?branch=container&subdir=docker
255+
```
256+
257+
| Build Syntax Suffix | Commit Used | Build Context Used |
258+
| -------------------------------------------- | ----------------------------- | ------------------ |
259+
| `myrepo.git` | `refs/heads/<default branch>` | `/` |
260+
| `myrepo.git?tag=mytag` | `refs/tags/mytag` | `/` |
261+
| `myrepo.git?branch=mybranch` | `refs/heads/mybranch` | `/` |
262+
| `myrepo.git?ref=pull/42/head` | `refs/pull/42/head` | `/` |
263+
| `myrepo.git?subdir=myfolder` | `refs/heads/<default branch>` | `/myfolder` |
264+
| `myrepo.git?branch=master&subdir=myfolder` | `refs/heads/master` | `/myfolder` |
265+
| `myrepo.git?tag=mytag&subdir=myfolder` | `refs/tags/mytag` | `/myfolder` |
266+
| `myrepo.git?branch=mybranch&subdir=myfolder` | `refs/heads/mybranch` | `/myfolder` |
267+
268+
A commit hash can be specified as a `commit` or `checksum` query, along with `tag`, `branch`, or `ref`.
269+
A hash does not need to be a full hash.
270+
271+
```bash
272+
docker buildx build 'https://github.com/moby/buildkit.git?tag=v0.21.1&checksum=66735c67'
273+
```
274+
248275
#### Keep `.git` directory
249276

250277
By default, BuildKit doesn't keep the `.git` directory when using Git contexts.

0 commit comments

Comments
 (0)