開發輔助

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 的最佳實踐、安全問題和最佳化建議,提供即時反饋和可操作的改進方案。它適合處理日常工作、學習、開發和資料整理中的具體任務,無需安裝額外軟體;在工具支援的情況下,輸入內容會保留在目前裝置中處理。

如何使用Dockerfile 檢查器

  1. 1在工具區域貼上、輸入或上傳需要處理的內容。
  2. 2根據任務選擇格式、尺寸、輸出方式或驗證選項。
  3. 3檢查預覽結果、提示資訊或轉換後的資料。
  4. 4確認結果無誤後再複製或下載,用於後續工作。

Dockerfile 檢查器的常見使用情境

快速完成日常任務

無需安裝桌面軟體,打開網頁即可處理常見的文字、圖片、資料或格式轉換工作。

檢查與整理內容

在提交檔案、發布內容或複製結果之前,快速發現格式問題並取得結構清楚的輸出。

重視隱私的瀏覽器處理

對於支援本機執行的工具,資料會留在目前瀏覽器中,不需要上傳到第三方服務。

常見問題

Dockerfile 檢查器可以解決什麼問題?

分析 Dockerfile 的最佳實踐、安全問題和最佳化建議,提供即時反饋和可操作的改進方案。

這個工具需要註冊或付費嗎?

不需要。你可以直接免費使用,不必建立帳號。

工具會上傳我的資料嗎?

工具會盡可能在瀏覽器本機執行。需要後端服務的功能會在頁面上明確標示。