Story Details

  • Dockerfmt: A Dockerfile Formatter

    Posted: 2025-04-09 01:21:22

    Dockerfmt is a command-line tool that automatically formats Dockerfiles, improving their readability and consistency. It restructures instructions, normalizes keywords, and adjusts indentation to adhere to best practices. The tool aims to eliminate manual formatting efforts and promote a standardized style across Dockerfiles, ultimately making them easier to maintain and understand. Dockerfmt is written in Go and can be installed as a standalone binary or used as a library.

    Summary of Comments ( 53 )
    https://news.ycombinator.com/item?id=43628037

    HN users generally praised dockerfmt for addressing a real need for Dockerfile formatting consistency. Several commenters appreciated the project's simplicity and ease of use, particularly its integration with gofmt. Some raised concerns, including the potential for unwanted changes to existing Dockerfiles during formatting and the limited scope of the current linting capabilities, wishing for more comprehensive Dockerfile analysis. A few suggested potential improvements, such as options to ignore certain lines or files and integration with pre-commit hooks. The project's reliance on regular expressions for parsing also sparked discussion, with some advocating for a more robust parsing approach using a proper grammar. Overall, the reception was positive, with many seeing dockerfmt as a useful tool despite acknowledging its current limitations.