@@ -245,12 +245,11 @@ docker build github.com/docker/buildx#d4f088e689b41353d74f1a0bfcd6d7c0b213aed2
245
245
docker build github.com/docker/buildx#d4f088e
246
246
```
247
247
248
- ### URL queries
248
+ #### URL queries
249
249
250
- Starting with Buildx v0.28 and BuildKit v0.24, URL queries are also supported.
251
- URL queries are more structured and recommended over [ URL fragments] ( #url-fragments ) .
250
+ Starting with Buildx v0.28, BuildKit v0.24 and Dockerfile v1.18 , URL queries are
251
+ also supported. URL queries are more structured and recommended over [ URL fragments] ( #url-fragments ) :
252
252
253
- For example,
254
253
``` console
255
254
$ docker buildx build ' https://github.com/user/myrepo.git?branch=container&subdir=docker'
256
255
```
@@ -266,13 +265,29 @@ $ docker buildx build 'https://github.com/user/myrepo.git?branch=container&subdi
266
265
| ` myrepo.git?tag=mytag&subdir=myfolder ` | ` refs/tags/mytag ` | ` /myfolder ` |
267
266
| ` myrepo.git?branch=mybranch&subdir=myfolder ` | ` refs/heads/mybranch ` | ` /myfolder ` |
268
267
269
- A commit hash can be specified as a ` commit ` or ` checksum ` query, along with ` tag ` , ` branch ` , or ` ref ` .
270
- A hash does not need to be a full hash.
268
+ A commit hash can be specified as a ` checksum ` (alias ` commit ` ) query, along
269
+ ` tag ` , ` branch ` , or ` ref ` queries to verify that the reference resolves to the
270
+ expected commit:
271
271
272
- ``` bash
273
- docker buildx build ' https://github.com/moby/buildkit.git?tag=v0.21.1&checksum=66735c67'
272
+ ``` console
273
+ $ docker buildx build ' https://github.com/moby/buildkit.git?tag=v0.21.1&checksum=66735c67'
274
+ ```
275
+
276
+ If it doesn't match, the build fails:
277
+
278
+ ``` console
279
+ $ docker buildx build ' https://github.com/user/myrepo.git?tag=v0.1.0&commit=deadbeef'
280
+ ...
281
+ #3 [internal] load git source https://github.com/user/myrepo.git?tag=v0.1.0-rc1&commit=deadbeef
282
+ #3 0.484 bb41e835b6c3523c7c45b248cf4b45e7f862bc42 refs/tags/v0.1.0
283
+ #3 ERROR: expected checksum to match deadbeef, got bb41e835b6c3523c7c45b248cf4b45e7f862bc42
274
284
```
275
285
286
+ > [ !NOTE]
287
+ >
288
+ > Short commit hash is supported with ` checksum ` (alias ` commit ` ) query but for
289
+ > ` ref ` , only the full hash of the commit is supported.
290
+
276
291
#### Keep ` .git ` directory
277
292
278
293
By default, BuildKit doesn't keep the ` .git ` directory when using Git contexts.
0 commit comments