Please copy past a Dockerfile in the editor on the left. The Dockerfile will be analyzed to indentify best-practice smells and repair suggestions. Note: The AST is fully reprint therefore there may have some slight differences in term of spacing. If you identify any other issue please report it.

  1. The Dockerfile is parsed into an AST representation.
  2. The AST is anotated to indentify URLs, PATH in bash commands.
  3. The AST is enriched with the stucture of frquent bash commands.
  4. The smells are identified using template matching.
  5. The smells are repaired by manipulating the AST.
  6. The repaired Dockerfiles are reprinted.

Rule Description
curlUseFlagF Use the -f flag when using curl.
npmCacheCleanAfterInstall Run npm cache clean after npm install
npmCacheCleanUseForce Use the --force flag when using npm cache clean.
rmRecursiveAfterMktempD A rm -r should occur after a mktemp -d
curlUseHttpsUrl Use https:// urls with curl
wgetUseHttpsUrl Use https:// urls with wget
pipUseNoCacheDir Use --no-cache-dir flag with pip
mkdirUsrSrcThenRemove After running mkdir /usr/src* use rm -rf /usr/src* to clean up.
configureShouldUseBuildFlag When using ./configure in a Dockerfile pass the --build flag.
gemUpdateSystemRmRootGem After running gem update --system remove the /root/.gem directory.
sha256sumEchoOneSpaces sha256sum takes an input on stdin with one space.
gemUpdateNoDocument If you run gem update you should have previously added the --no-document flag to the .gemrc config.
gpgVerifyAscRmAsc If you run gpg --verify X.asc you should remove the X.asc file.
yumInstallForceYes Use the -y flag with yum install.
yumInstallRmVarCacheYum If you run yum install ... you should remove the /var/cache/yum directory.
tarSomethingRmTheSomething If you run tar X.tar you should remove the X.tar file.
gpgUseBatchFlag Use the --batch flag when using gpg in a docker image.
gpgUseHaPools Use ha.pool.* instead of pool.* with gpg.
ruleAptGetInstallUseY Must use the -y flag to avoid apt-get install requesting user interaction.
ruleAptGetInstallUseNoRec Use the --no-install-recommends flag to save layer space and avoid hidden dependencies.
ruleAptGetUpdatePrecedesInstall apt-get update && apt-get install should happen in a single layer.
ruleAptGetInstallThenRemoveAptLists rm -rf /var/lib/apt/lists/* after apt-get install to save layer space.
apkAddUseNoCache Use the --no-cache flag when using apk add.

{{results.queries.commands.length}} Commands: {{results.queries.commands.join(', ')}}
{{results.queries.packages.length}} Packages: {{results.queries.packages.join(', ')}}
{{results.queries.urls.length}} URLs: {{results.queries.urls.join(', ')}}
{{results.queries.paths.length}} Paths: {{results.queries.paths.join(', ')}}

Query the Dockerfile AST. Write a note type per line and represent the hierarchy with indentation or space.

  • {{r.toString(true)}}

{{index + 1}}. {{smell.rule.name}} at line {{smell.position.lineStart + 1}}