finds.dev

jessfraz/dockfmt

Dockerfile format and parser. Like `gofmt` but for Dockerfiles.

View on GitHub

★ 441GoMITupdated Jan 2024

// the take

dockfmt is a small Go CLI that reformats Dockerfiles for consistent whitespace and instruction casing, the same idea as gofmt but for Docker. It also bundles a few audit subcommands (base image, maintainer, stage, workdir listing) meant for scanning a pile of Dockerfiles at once rather than editing one file by hand.

It parses with moby/buildkit's actual Dockerfile parser (vendored) instead of a hand-rolled regex parser, so multi-stage builds and instruction edge cases are handled correctly. The fmt subcommand supports -d/-w/-l flags mirroring gofmt's diff/write/list conventions, which makes it trivial to drop into a CI lint step. The base/maintainer/workdir inspection commands are genuinely useful for auditing dozens of Dockerfiles across a monorepo, something most Dockerfile linters don't offer.

The README literally says 'work in progress' and tells people not to file issues, which is a clear signal there's no real support behind it despite a 2024 push date. It still has a whole subcommand for inspecting MAINTAINER, an instruction Docker deprecated in favor of LABEL years ago, showing the tool hasn't tracked current Dockerfile conventions. Dependencies are vendored under vendor/ on top of go.mod/go.sum, which bloats the repo and makes bumping the underlying buildkit parser for newer syntax (heredocs, COPY --from by name) more work than it should be. There's no config file or ignore mechanism, so you can't exclude generated or vendored Dockerfiles from a bulk fmt/list run.

We read the README, the directory tree and a key source file in September 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
441
Forks
21
Language
Go
License
MIT
Last commit
31 Jan 2024

// nearby

If dockfmt isn't quite it.

All repos →