# 使用 Homebrew, Nix 安装 dockerfmt

查看 dockerfmt 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:dockerfmt
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install dockerfmt
```

  证据: local Homebrew formula metadata

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#dockerfmt
```

  证据: nixpkgs package indexes: pkgs/by-name/do/dockerfmt/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

## 软件包事实

- **软件包键:** brew:dockerfmt
- **软件包管理器:** Homebrew
- **版本:** 0.5.4
- **来源摘要:** Dockerfile format and parser. a modern dockfmt
- **主页:** <https://github.com/reteps/dockerfmt>
- **仓库:** <https://github.com/reteps/dockerfmt>
- **最后更新:** 2026-07-28T14:10:41+02:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- dockerfmt (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 0.5.4
## 项目历史与用法

dockerfmt is a young, opinionated Dockerfile formatter that combines Dockerfile parsing with shell-command formatting for `RUN` instructions.

### 项目历史

The reteps/dockerfmt repository was created in April 2025 and published its initial alpha release the next day. The README presents it as a modern successor to Jessie Frazelle's earlier `dockfmt`, built on the Moby BuildKit parser and using `shfmt` for shell fragments inside Dockerfile `RUN` steps.

The project quickly moved through 0.2.x releases in April 2025 and reached 0.5.4 in June 2026. The README's feature set includes whitespace normalization, inline-comment preservation, legacy `ENV key value` conversion, deprecated `MAINTAINER` conversion to `LABEL`, heredoc support, stdin/file operation, pre-commit support, JS/WASM bindings, and a Docker image for CI.

### 采用历史

Because dockerfmt is new, public adoption evidence is still thin. Its package-manager footprint is nevertheless real: Homebrew reported stable version 0.5.4, 69 installs in the previous 30 days, and 548 installs in the previous year as of June 30, 2026.

Its adoption story is also a lineage story: it exists because Dockerfile formatting remained useful after `dockfmt`, while modern BuildKit syntax, shell formatting expectations, pre-commit workflows, and CI images needed a fresher implementation.

### 使用方式

Users run `dockerfmt Dockerfile` to print formatted output, `dockerfmt -w Dockerfile` to rewrite files, `dockerfmt -c Dockerfile` to check formatting, or pipe Dockerfiles through stdin. It can read EditorConfig properties such as `indent_size` and `insert_final_newline` when formatting files by path.

### 为什么软件包爱好者会关心

dockerfmt is package-nerd significant because formatters become part of project policy. By exposing a Go binary, Docker image, pre-commit hook, and JS/WASM bindings, it tries to make Dockerfile formatting usable from local editors, CI, JavaScript tooling, and ordinary package managers.

### 时间线

- 2025: Repository created and 0.1.0-alpha initial release published.
- 2025: 0.2.x releases added JavaScript release work and bug fixes.
- 2026: 0.5.4 released and Homebrew formula reports stable 0.5.4.

### Related projects

- dockerfmt is directly related to `dockfmt`, Moby BuildKit's Dockerfile parser, and `shfmt`.
- It also fits into pre-commit and CI formatting workflows, similar to language-specific formatters such as gofmt and prettier, but for Dockerfiles.

### 来源

- <https://github.com/reteps/dockerfmt#readme>
- <https://api.github.com/repos/reteps/dockerfmt>
- <https://github.com/reteps/dockerfmt/releases/tag/0.1.0-alpha>
- <https://github.com/reteps/dockerfmt/releases/tag/v0.5.4>
- <https://formulae.brew.sh/api/formula/dockerfmt.json>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals

## 其他软件包管理器记录

- Nix - dockerfmt: normalized package name match | nixpkgs package indexes: pkgs/by-name/do/dockerfmt/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1


## Combined YAML source

View the package source record on GitHub. [combined/dockerfmt.yml](https://github.com/mxcl/pkgdb/blob/main/combined/dockerfmt.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
