You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To comply with [Docker best practices][dbp], we are using the [Hadolint][hadolint] tool to analyse each `Dockerfile` .
4
+
5
+
## Installation
6
+
7
+
There is a specific `make` target to install the linter.
8
+
By default `hadolint` will be installed in `${HOME}/hadolint`.
9
+
10
+
```bash
11
+
$ make lint-install
12
+
13
+
# Installing hadolint at /Users/romain/hadolint ...
14
+
# Installation done!
15
+
# Haskell Dockerfile Linter v1.17.6-0-gc918759
16
+
```
17
+
18
+
## Lint
19
+
20
+
### Per Stack
21
+
22
+
The linter can be run per stack.
23
+
24
+
```bash
25
+
$ make lint/scipy-notebook
26
+
27
+
# Linting Dockerfiles in scipy-notebook...
28
+
# scipy-notebook/Dockerfile:4 DL3006 Always tag the version of an image explicitly
29
+
# scipy-notebook/Dockerfile:11 DL3008 Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
30
+
# scipy-notebook/Dockerfile:18 SC2086 Double quote to prevent globbing and word splitting.
31
+
# scipy-notebook/Dockerfile:68 SC2086 Double quote to prevent globbing and word splitting.
32
+
# scipy-notebook/Dockerfile:68 DL3003 Use WORKDIR to switch to a directory
33
+
# scipy-notebook/Dockerfile:79 SC2086 Double quote to prevent globbing and word splitting.
34
+
# make: *** [lint/scipy-notebook] Error 1
35
+
```
36
+
37
+
Optionally you can pass arguments to the linter.
38
+
39
+
```bash
40
+
# Use a different export format
41
+
$ make lint/scipy-notebook ARGS="--format codeclimate"
42
+
```
43
+
44
+
### All the Stacks
45
+
46
+
The linter can be run against all the stacks.
47
+
48
+
```bash
49
+
$ make lint-all
50
+
```
51
+
52
+
## Ignoring Rules
53
+
54
+
Sometimes it is necessary to ignore [some rules][rules].
55
+
The following rules are ignored by default and sor for all images in the `.hadolint.yaml` file.
56
+
57
+
-[`DL3006`][DL3006]: We use a specific policy to manage image tags.
58
+
-`base-notebook``FROM` clause is fixed but based on an argument (`ARG`).
59
+
- Building downstream images from (`FROM`) the latest is done on purpose.
60
+
-[`DL3008`][DL3008]: System packages are always updated (`apt-get`) to the latest version.
61
+
62
+
For other rules, the preferred way to do it is to flag ignored rules in the `Dockerfile`.
63
+
64
+
> It is also possible to ignore rules by using a special comment directly above the Dockerfile instruction you want to make an exception for. Ignore rule comments look like `# hadolint ignore=DL3001,SC1081`. For example:
0 commit comments