Skip to content
Novus Examples
yaml608 B

Docker Compose File, Intentionally Invalid

An intentionally invalid Compose file: services as a list, a service with both image and an empty build, an unquoted 8080:8080 port that YAML 1.1 reads as a base-60 integer, and a depends_on naming an undefined service.

Preview — first 15 linesyaml
# INTENTIONALLY INVALID. Well-formed YAML, invalid Compose in four documented ways:
#   1. `services` is a list where a mapping of service names is required
#   2. a service declares both `image` and `build` with no context for the build
#   3. `ports` uses the unquoted 8080:8080 form, which YAML 1.1 reads as the base-60 integer
#      29280080 rather than a port mapping string
#   4. `depends_on` names a service that is not defined
services:
  - api:
      image: registry.example.invalid/example-org/orders:1.4.0
      build:
      ports:
        - 8080:8080
      depends_on:
        - does-not-exist

Specifications

Variant
intentionally invalid
Yaml Well Formed
true
Violations
4
Sexagesimal Port
8080:8080 reads as 29280080 under YAML 1.1

Testing contract

Expected to fail
Scenario
Validate a Compose file whose unquoted port mapping is coerced by the YAML resolver
Expected result
Under a YAML 1.1 loader the port value becomes the integer 29280080 instead of a mapping string, and schema validation additionally rejects services being a list

What is a .yaml file?

YAML (YAML Ain't Markup Language) is a human-readable data-serialization format using indentation, key-value pairs, and lists, and is a superset of JSON. It supports comments, anchors, and multiple documents per file, favoring readability for configuration. Its indentation sensitivity makes it error-prone to hand-edit.

How to use this file

Use an example YAML file to test config parsers, indentation and anchor handling, multi-document streams, and safe-loading to avoid arbitrary object construction.

How to use this file for testing

“Docker Compose File, Intentionally Invalid” is a deterministic Novus Examples fixture for Error handling, Config parsing, Schema validation. Deliberately corrupt and invalid files, clearly labelled, for testing how your tool fails.

Documented properties for this file: YAML · 608 bytes. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Pipeline and infrastructure fixtures are inert configuration: steps reference fictional images and scripts, and nothing here executes. Run your linter, schema validator, migrator, or policy engine against them, and expect the deprecated-syntax and intentionally invalid variants to be rejected.

Code examples

import yaml  # pip install pyyaml

with open("compose-invalid.yaml") as f:
    data = yaml.safe_load(f)
print(data)

Generated by generation/pipelines.py. Free for any use, no attribution required — license.