Format Dockerfile Online — Instruction Normalizer

Normalize Dockerfile instruction casing and spacing with dockerfile-utils — browser-local formatting.

Loading…
Dockerfile formatter — instruction normalization
Turn lowercase or inconsistent Dockerfiles into readable, review-friendly instructions before opening a PR or sharing in docs.

Developer notes

• Loads dockerfile-utils on demand. • Normalizes instruction casing even when format returns no TextEdits. • Does not run Hadolint or ShellCheck. • Syntax errors may surface from the formatter validator.

When teams pick this route

• Normalize Dockerfiles copied from blog posts (often lowercase). • Prepare a Dockerfile snippet for internal style guides. • Quick format before lint-dockerfile for DL rules. • Clean up hand-edited multi-stage files.

Worked examples

Lowercase instructions from a tutorial

Before

from node:20-alpine workdir /app copy package*.json ./ run npm ci --omit=dev copy . . expose 3000 cmd ["npm", "start"]

After format

FROM node:20-alpine WORKDIR /app COPY package*.json ./ RUN npm ci --omit=dev COPY . . EXPOSE 3000 CMD ["npm", "start"]

Multi-stage build skeleton

Before

from golang:1.22 AS build workdir /src copy go.mod go.sum ./ run go build -o /bin/api ./cmd/api from gcr.io/distroless/base COPY --from=build /bin/api /api entrypoint ["/api"]

After format

FROM golang:1.22 AS build WORKDIR /src COPY go.mod go.sum ./ RUN go build -o /bin/api ./cmd/api FROM gcr.io/distroless/base COPY --from=build /bin/api /api ENTRYPOINT ["/api"]

Navigate related DevOps tools

Run lint Dockerfile for DL rules, or open the DevOps hub.

Dockerfile formatter FAQ

Layout and casing

Same as hadolint?

No — this tool formats layout and casing. Use lint-dockerfile for best-practice DL rules.

Does it fix JSON CMD form?

It normalizes keywords; switch shell-form CMD to JSON manually or via lint suggestions.

Multi-stage builds?

Yes — each stage is formatted in place.

Looking for converters, encoders, formatters, and minifiers in one place? Developer tools hub Open the curated developer tools catalogue.