Dockerfile Formatter

Format a Dockerfile and get best-practice / lint suggestions.

Your Dockerfile is formatted and linted locally in your browser, and nothing you paste is uploaded to a server.

Managing build context? Generate a .gitignore with the Gitignore Generator.

About Dockerfile Formatter

This dockerfile formatter cleans up your Dockerfile and checks it against Docker best practices in one pass. Paste a Dockerfile and it normalizes each instruction keyword to uppercase, trims trailing whitespace, and collapses repeated blank lines so the file reads consistently. Acting as a lightweight dockerfile linter, it also flags common issues: unpinned base-image tags, ADD where COPY belongs, apt-get installs missing --no-install-recommends, leftover apt caches, sudo usage, cd inside RUN, combinable RUN layers, and containers left running as root. It is built for developers and DevOps engineers who want to format a Dockerfile online and tighten up image builds following dockerfile best practices before committing. Everything runs locally in your browser, so the Dockerfile you paste is processed on your machine and your data never leaves your device.

Features

How to use the Dockerfile Formatter

  1. Paste your Dockerfile into the input box.
  2. Read the cleaned, instruction-uppercased output in the Formatted Dockerfile pane.
  3. Review the best-practice checks below the output for WARN and TIP suggestions.
  4. Apply the fixes you want, then copy or download the result as a Dockerfile.

Example

Input

from node:latest
run apt-get update && apt-get install curl
copy . .
cmd ["node","app.js"]

Output

FROM node:latest
RUN apt-get update && apt-get install curl
COPY . .
CMD ["node","app.js"]

Instructions are uppercased and tidied; the checks panel still warns to pin the node tag, add --no-install-recommends, and set a non-root USER.

Common errors & troubleshooting

Frequently asked questions

What is the ArrayKit Dockerfile Formatter and what does it change?
It is an in-browser dockerfile formatter that uppercases each instruction keyword, trims trailing whitespace, and collapses multiple blank lines into one. It does not rewrite or reorder your commands, so your build logic stays intact.
How do I lint my Dockerfile for best practices with this tool?
Just paste your Dockerfile. Alongside formatting it runs checks for unpinned base tags, ADD vs COPY, apt-get flags and cache cleanup, sudo usage, cd in RUN, combinable RUN layers, and running as root, shown as WARN and TIP suggestions with line numbers.
Why is the Dockerfile Formatter warning me to pin my base image tag?
Using :latest or no tag means your build can change unexpectedly when the base image updates. Pinning a specific tag, like node:20-alpine, makes builds reproducible.
Can I download the formatted Dockerfile?
Yes, you can copy the output or download it as a plain Dockerfile directly from the formatted output pane.
Is my Dockerfile uploaded anywhere when I use this formatter?
No. The Dockerfile formatter runs entirely in your browser and the file you paste is processed locally, so your data never leaves your device and nothing is sent to a server.

Related tools

All ArrayKit tools