跳到主要内容
bobob

YAML 格式校验

验证并格式化 YAML,同时检查 Docker Compose services、ports、volumes、environment 和 depends_on。

只在浏览器里处理输入的内容不会发送到服务器。

输入与结果

输入的内容只存在这个浏览器。重新打开可以还原上次的操作。

  • 验证并格式化 YAML,同时检查 Docker Compose services、ports、volumes、environment 和 depends_on。
  • 以浏览器本地方式处理输入,并在复制前检查结果。
常见输入
services: app: image: node:20
用此示例检查 YAML 格式校验 的输入流程。
典型输出
有效 YAML / Docker Compose 诊断 / YAML 部署报告
复制前用于确认结果格式和后续检查点。
附加示例
services: web: image: nginx ports: - "8080:80"
复制前用于确认结果格式和后续检查点。
附加示例
app: features: login: true audit: false
复制前用于确认结果格式和后续检查点。
  • 如果浏览器本地处理方式和真实输入结构不一致,输出不能直接信任。
  • 复制的值中如果混入生产密钥、客户数据或内部 URL,分享前必须移除。
  • 计算在浏览器里完成,输入特别长时出结果前可能会卡一下。
  1. 1再次比较原始输入和输出形态。
  2. 2确认目标运行时、编码、时区和安全策略差异。
  • No tabs in indentation

    The YAML 1.2.2 specification says tab characters must not be used in indentation, because systems treat tabs differently. The parser here rejects tab indentation, and the tool adds a separate warning whenever a tab appears anywhere.

    依据:YAML 1.2.2 (2021)

  • yes and no are not booleans in YAML 1.2

    YAML 1.2's Core schema resolves only true and false (in their case variants) as booleans; reading yes, no, on and off as booleans was YAML 1.1. This tool follows 1.2 and keeps yes as a string, but a 1.1 tool reads the same line as true, hence the warning to quote it.

    依据:YAML 1.2.2 (2021)

  • A Compose service needs an image or a build

    In the Compose specification a service is defined by a Docker image and runtime arguments, and a build section can say how to create that image. So the tool warns when a service has neither, and when depends_on names a service that does not exist.

    依据:Docker Docs, Compose file reference

YAML 格式校验 的输入在哪里处理?

可行的处理会在浏览器中执行,但不要输入生产密钥或客户数据。

结果可以直接用于生产吗?

复制前请再次确认运行环境、编码、时区和安全策略等环境差异。