Sample Docker Compose YAML

A Compose file describing a web service, a database and a cache, with environment variables, ports, volumes, a health check and an anchor that is reused with an alias.

Download

sample-docker-compose.yaml

744 B744 bytes

Download YAML sample

Direct download. No sign-up and no waiting.

Type
application/yaml
SHA-256
578f628c06f26f7ca5885e12b3aaf69331e8c5d3a7411161a9c929a166c2e011
Direct URL
https://sampletestfiles.com/downloads/samples/sample-docker-compose.yaml

Why test with this file

A realistic configuration file for testing YAML parsers, linters and editors.

Services3
FeaturesAnchors and aliases, sequences, nested mappings, quoted strings, comments
EncodingUTF-8

What to check

After your application has processed sample-docker-compose.yaml, confirm that:

How the file begins

The opening lines of sample-docker-compose.yaml, exactly as they appear in the file.

# Sample Docker Compose file for testing YAML tooling
x-defaults: &defaults
  restart: unless-stopped
  logging:
    driver: json-file
    options:
      max-size: "10m"

services:
  web:
    <<: *defaults
    image: nginx:stable
    ports:
      - "8080:80"

Preview

Shows the file contents.

Technical details

File namesample-docker-compose.yaml
FormatYAML (YAML Ain't Markup Language)
Extension.yaml
MIME typeapplication/yaml
Size744 bytes (744 B)
KindText
SHA-256578f628c06f26f7ca5885e12b3aaf69331e8c5d3a7411161a9c929a166c2e011
Created2026-10-10
ValidationExact size, signature bytes and structure checked when the file was generated
PreviewAvailable on this page
SourceGenerated for this site; not copied from elsewhere
LicenceFree to use, modify and redistribute (terms)
CategoryConfiguration

Validated for expected format and integrity. As with any download, scan the file with your own security tools before opening it. How files are made and checked

Download from the command line and verify

Fetch the file with curl, then compare its checksum with the SHA-256 value above.

curl -o sample-docker-compose.yaml 'https://sampletestfiles.com/downloads/samples/sample-docker-compose.yaml'
sha256sum sample-docker-compose.yaml     # Linux
shasum -a 256 sample-docker-compose.yaml # macOS

On Windows, run Get-FileHash sample-docker-compose.yaml -Algorithm SHA256 in PowerShell. A matching value proves that the download is complete and unaltered.

About YAML

Human-friendly data serialisation that relies on indentation. The format of most infrastructure configuration.

YAML format reference

Where it fits

Related files

All curated sample files