Dcokerfileチェッカーとは?

昨今Dockerを使って開発を行うことが当たり前になり、Dockerfileも徐々に複雑になりメンテナンスするだけでも大変で更にパフォーマンスチューニングとなると・・・「Dcokerfileチェッカー」はDockerfileをベストプラクティス に従っているかチェックが行なえます。
ルール重要度詳細
DL1001IgnorePlease refrain from using inline Ignore pragmas # hadolint Ignore=DLxxxx.
DL3000ErrorUse absolute WORKDIR.
DL3001InfoFor some bash commands it makes no sense running them in a Docker container like ssh, vim, shutdown, service, ps, free, top, kill, mount, ifconfig.
DL3002WarningLast user should not be root.
DL3003WarningUse WORKDIR to switch to a directory.
DL3004ErrorDo not use sudo as it leads to unpredictable behavior. Use a tool like gosu to enforce root.
DL3005ErrorDo not use apt-get dist-upgrade.
DL3006WarningAlways tag the version of an image explicitly.
DL3007WarningUsing latest is prone to Errors if the image will ever update. Pin the version explicitly to a release tag.
DL3008WarningPin versions in apt-get install.
DL3009InfoDelete the apt-get lists after installing something.
DL3010InfoUse ADD for extracting archives into an image.
DL3011ErrorValid UNIX ports range from 0 to 65535.
DL3012ErrorMultiple HEALTHCHECK instructions.
DL3013WarningPin versions in pip.
DL3014WarningUse the -y switch.
DL3015InfoAvoid additional packages by specifying --no-install-recommends.
DL3016WarningPin versions in npm.
DL3018WarningPin versions in apk add. Instead of apk add <package> use apk add <package>=<version>.
DL3019InfoUse the --no-cache switch to avoid the need to use --update and remove /var/cache/apk/* when done installing packages.
DL3020ErrorUse COPY instead of ADD for files and folders.
DL3021ErrorCOPY with more than 2 arguments requires the last argument to end with /
DL3022WarningCOPY --from should reference a previously defined FROM alias
DL3023ErrorCOPY --from cannot reference its own FROM alias
DL3024ErrorFROM aliases (stage names) must be unique
DL3025WarningUse arguments JSON notation for CMD and ENTRYPOINT arguments
DL3026ErrorUse only an allowed registry in the FROM image
DL3027WarningDo not use apt as it is meant to be a end-user tool, use apt-get or apt-cache instead
DL3028WarningPin versions in gem install. Instead of gem install <gem> use gem install <gem>:<version>
DL3029WarningDo not use --platform flag with FROM.
DL3030WarningUse the -y switch to avoid manual input yum install -y <package>
DL3032Warningyum clean all missing after yum command.
DL3033WarningSpecify version with yum install -y <package>-<version>
DL3034WarningNon-interactive switch missing from zypper command: zypper install -y
DL3035WarningDo not use zypper dist-upgrade.
DL3036Warningzypper clean missing after zypper use.
DL3037WarningSpecify version with zypper install -y <package>[=]<version>.
DL3038WarningUse the -y switch to avoid manual input dnf install -y <package>
DL3040Warningdnf clean all missing after dnf command.
DL3041WarningSpecify version with dnf install -y <package>-<version>
DL3042WarningAvoid cache directory with pip install --no-cache-dir <package>.
DL3043ErrorONBUILD, FROM or MAINTAINER triggered from within ONBUILD instruction.
DL3044ErrorDo not refer to an environment variable within the same ENV statement where it is defined.
DL3045WarningCOPY to a relative destination without WORKDIR set.
DL3046Warninguseradd without flag -l and high UID will result in excessively large Image.
DL3047Infowget without flag --progress will result in excessively bloated build logs when downloading larger files.
DL3048StyleInvalid Label Key
DL3049InfoLabel <label> is missing.
DL3050InfoSuperfluous label(s) present.
DL3051WarningLabel <label> is empty.
DL3052WarningLabel <label> is not a valid URL.
DL3053WarningLabel <label> is not a valid time format - must be conform to RFC3339.
DL3054WarningLabel <label> is not a valid SPDX license identifier.
DL3055WarningLabel <label> is not a valid git hash.
DL3056WarningLabel <label> does not conform to semantic versioning.
DL3057IgnoreHEALTHCHECK instruction missing.
DL3058WarningLabel <label> is not a valid email format - must be conform to RFC5322.
DL3059InfoMultiple consecutive RUN instructions. Consider consolidation.
DL3060Infoyarn cache clean missing after yarn install was run.
DL3061ErrorInvalid instruction order. Dockerfile must begin with FROM, ARG or comment.
DL4000ErrorMAINTAINER is deprecated.
DL4001WarningEither use Wget or Curl but not both.
DL4003WarningMultiple CMD instructions found.
DL4004ErrorMultiple ENTRYPOINT instructions found.
DL4005WarningUse SHELL to change the default shell.
DL4006WarningSet the SHELL option -o pipefail before RUN with a pipe in it
SC1000$ is not used specially and should therefore be escaped.
SC1001This \c will be a regular 'c' in this context.
SC1007Remove space after = if trying to assign a value (or for empty string, use var='' ...).
SC1010Use semicolon or linefeed before done (or quote to make it literal).
SC1018This is a unicode non-breaking space. Delete it and retype as space.
SC1035You need a space here
SC1045It's not foo &; bar, just foo & bar.
SC1065Trying to declare parameters? Don't. Use () and refer to params as $1, $2 etc.
SC1066Don't use $ on the left side of assignments.
SC1068Don't put spaces around the = in assignments.
SC1077For command expansion, the tick should slant left (` vs ´).
SC1078Did you forget to close this double-quoted string?
SC1079This is actually an end quote, but due to next char, it looks suspect.
SC1081Scripts are case sensitive. Use if, not If.
SC1083This {/} is literal. Check expression (missing ;/\n?) or quote it.
SC1086Don't use $ on the iterator name in for loops.
SC1087Braces are required when expanding arrays, as in ${array[idx]}.
SC1095You need a space or linefeed between the function name and body.
SC1097Unexpected ==. For assignment, use =. For comparison, use [ .. ] or [[ .. ]].
SC1098Quote/escape special characters when using eval, e.g. eval "a=(b)".
SC1099You need a space before the #.
SC2002Useless cat. Consider cmd < file | .. or cmd file | .. instead.
SC2015Note that A && B || C is not if-then-else. C may run when A is true.
SC2026This word is outside of quotes. Did you intend to 'nest '"'single quotes'"' instead'?
SC2028echo won't expand escape sequences. Consider printf.
SC2035Use ./*glob* or -- *glob* so names with dashes won't become options.
SC2039In POSIX sh, something is undefined.
SC2046Quote this to prevent word splitting
SC2086Double quote to prevent globbing and word splitting.
SC2140Word is in the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
SC2154var is referenced but not assigned.
SC2155Declare and assign separately to avoid masking return values.
SC2164Use cd ... || exit in case cd fails.