@@ -118,15 +118,25 @@ and don't show up as build steps. Parser directives are written as a
118
118
special type of comment in the form `# directive=value`. A single directive
119
119
may only be used once.
120
120
121
+ The following parser directives are supported:
122
+
123
+ - [`syntax`](#syntax)
124
+ - [`escape`](#escape)
125
+ - [`check`](#check) (since Dockerfile v1.8.0)
126
+
121
127
Once a comment, empty line or builder instruction has been processed, BuildKit
122
128
no longer looks for parser directives. Instead it treats anything formatted
123
129
as a parser directive as a comment and doesn' t attempt to validate if it might
124
130
be a parser directive. Therefore, all parser directives must be at the
125
131
top of a Dockerfile.
126
132
127
- Parser directives aren't case-sensitive, but they' re lowercase by convention.
128
- It's also conventional to include a blank line following any parser directives.
129
- Line continuation characters aren' t supported in parser directives.
133
+ Parser directive keys, such as `syntax` or `check`, aren't case-sensitive, but
134
+ they' re lowercase by convention. Values for a directive are case-sensitive and
135
+ must be written in the appropriate case for the directive. For example,
136
+ `#check=skip=jsonargsrecommended` is invalid because the check name must use
137
+ Pascal case, not lowercase. It's also conventional to include a blank line
138
+ following any parser directives. Line continuation characters aren' t supported
139
+ in parser directives.
130
140
131
141
Due to these rules, the following examples are all invalid:
132
142
@@ -308,6 +318,46 @@ Successfully built 01c7f3bef04f
308
318
PS E:\myproject>
309
319
```
310
320
321
+ ### check
322
+
323
+ ``` dockerfile
324
+ # check=skip=<checks|all>
325
+ # check=error=<boolean>
326
+ ```
327
+
328
+ The ` check ` directive is used to configure how [ build checks] ( https://docs.docker.com/build/checks/ )
329
+ are evaluated. By default, all checks are run, and failures are treated as
330
+ warnings.
331
+
332
+ You can disable specific checks using ` #check=skip=<check-name> ` . To specify
333
+ multiple checks to skip, separate them with a comma:
334
+
335
+ ``` dockerfile
336
+ # check=skip=JSONArgsRecommended,StageNameCasing
337
+ ```
338
+
339
+ To disable all checks, use ` #check=skip=all ` .
340
+
341
+ By default, builds with failing build checks exit with a zero status code
342
+ despite warnings. To make the build fail on warnings, set ` #check=error=true ` .
343
+
344
+ ``` dockerfile
345
+ # check=error=true
346
+ ```
347
+
348
+ To combine both the ` skip ` and ` error ` options, use a semi-colon to separate
349
+ them:
350
+
351
+ ``` dockerfile
352
+ # check=skip=JSONArgsRecommended;error=true
353
+ ```
354
+
355
+ To see all available checks, see the [ build checks reference] ( https://docs.docker.com/reference/build-checks/ ) .
356
+ Note that the checks available depend on the Dockerfile syntax version. To make
357
+ sure you're getting the most up-to-date checks, use the [ ` syntax ` ] ( #syntax )
358
+ directive to specify the Dockerfile syntax version to the latest stable
359
+ version.
360
+
311
361
## Environment replacement
312
362
313
363
Environment variables (declared with [ the ` ENV ` statement] ( #env ) ) can also be
0 commit comments