開発支援

Dockerfile リンター

Dockerfile のベストプラクティス、セキュリティ上の問題、最適化ポイントを解析します。

無料で利用 登録不要 ブラウザ内で実行

ツール操作エリア

2 errors 10 warnings 3 info
Line 1DL3007ERROR

Using `latest` tag in FROM (image: ubuntu:latest)

Pin a specific version tag, e.g. ubuntu:22.04 instead of ubuntu:latest.

Line 8DL3020ERROR

ADD used where COPY would suffice

Use COPY instead of ADD for copying local files. ADD has extra features (auto-extract, remote URLs) that can be surprising.

Line 2DL4000WARNING

MAINTAINER is deprecated

Use LABEL maintainer="[email protected]" instead.

Line 5DL3015WARNING

Using `apt-get install` without `--no-install-recommends`

Add --no-install-recommends to avoid installing unnecessary packages and reduce image size.

Line 6DL3014WARNING

Using `apt-get install` without `-y` flag

Add -y flag to avoid interactive prompts: apt-get install -y.

Line 6DL3015WARNING

Using `apt-get install` without `--no-install-recommends`

Add --no-install-recommends to avoid installing unnecessary packages and reduce image size.

Line 6DL3009WARNING

Missing `apt-get clean` or `rm -rf /var/lib/apt/lists/*` after install

Clean up apt cache in the same RUN layer to reduce image size.

Line 11DL3004WARNING

Using `sudo` in Dockerfile

Avoid sudo. Use USER to switch users, or run commands as root directly (default in Docker).

Line 13DL3011WARNING

EXPOSE with no port number

Specify a valid port number, e.g. EXPOSE 8080.

Line 15DL3006WARNING

Missing HEALTHCHECK instruction

Add a HEALTHCHECK to let Docker know how to check that the container is still working.

Line 15DL3002WARNING

Running as root — no USER instruction found

Add a USER instruction to run the container as a non-root user for better security.

Line 15DL3025WARNING

CMD uses shell form instead of exec form

Use exec form: CMD ["executable", "arg1", "arg2"] for proper signal handling.

Line 1DL3005INFO

Consider using a .dockerignore file

A .dockerignore file helps exclude unnecessary files from the build context, speeding up builds and reducing image size.

Line 4DL3003INFO

4 consecutive RUN instructions found

Combine RUN instructions using && to reduce image layers.

Line 9DL3000INFO

WORKDIR should use an absolute path

Use an absolute path, e.g. WORKDIR /app instead of WORKDIR app.

Dockerfile リンターとは?

Dockerfile リンターは、Dockerfile のベストプラクティス、セキュリティ上の問題、最適化ポイントを解析します。生の入力を読みやすく分解し、構造や注意点を短時間で確かめたい場面に向いています。結果は一次確認に便利ですが、最終判断には公式仕様や実環境の挙動もあわせて確認してください。

Dockerfile リンターの使い方

  1. 1対象の文字列、ヘッダー、トークン、設定、証明書などを入力欄へ貼り付けるか読み込みます。
  2. 2必要なモードや判定条件を選び、解析結果や警告を表示します。
  3. 3展開されたフィールド、検証結果、注意点を確認し、必要ならコピーして共有します。

Dockerfile リンターの主な用途

内容の一次確認

入力の構造や中身を短時間で把握できます。

障害調査の切り分け

ログや設定断片を見比べながら、問題箇所の候補を絞り込みやすくします。

共有前の整理

レビュー依頼や手順書に載せる前に、必要な情報だけを抜き出してまとめられます。

よくある質問

この結果だけで最終判断できますか?

これは素早い確認向けのツールです。正式な仕様書、元データ、実運用環境の結果と併せて確認してください。

機密データを入力しても大丈夫ですか?

扱う前に、ブラウザの保存設定や組織ポリシー、利用環境のログ取得有無を確認してください。本番値ではなく匿名化したサンプルを使えるなら、その方が安全です。