開發輔助

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="name@example.com" 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 檢查器

  1. 1先填寫“Dockerfile Content”中的必要內容。
  2. 2按需修改選項或補充輸入,結果會隨著頁面狀態自動更新。
  3. 3檢查結果區域中的輸出。

Dockerfile 檢查器的常見使用場景

整理程式碼或配置

在提交、複製或交接前把程式碼片段、配置引數和產生結果整理成更清晰的形式。

製作測試與演示樣例

快速準備本地可複用的範例資料、佔位內容或文件片段,方便聯調與演示。

排查格式與相容問題

當建構、渲染或工具鏈報錯時,先在頁面裡檢查格式細節和輸出結構。

常見問題

檢查透過就代表結果一定會被官方系統、生產環境或第三方服務接受嗎?

不一定。這個工具會按照頁面目前支援的規則檢查常見結構和格式問題,但不能替代目標平臺、瀏覽器、鏈上節點、憑證鏈或正式驗證流程的最終判斷。

我應該怎樣準備輸入內容?

最穩妥的做法是按照頁面中的標籤、佔位範例和欄位順序輸入原始資料。若某個系統還有額外約束,例如大小寫、分隔符或欄位長度,請同時以你的業務規範為準。

資料會離開我的裝置嗎?

不會。此工具會直接在你的瀏覽器中處理輸入內容,不需要把資料上傳到我們的伺服器。若你要處理敏感資訊,仍建議在複製、下載或分享前先自行確認內容。