Codepackr / validators / Docker & Kubernetes YAML Linter

Docker & Kubernetes YAML Linter

Lint, validate, and verify structural syntax for Docker Compose and Kubernetes YAML resource manifests.

Client-Side Execution & Privacy Guarantee

This utility executes 100% locally in your web browser. Your inputs, tokens, queries, and data payloads are never transmitted to any external server or backend.

Docker Compose files and Kubernetes manifests are YAML documents that must follow specific structural conventions. The Docker & Kubernetes YAML Linter parses the input, identifies whether it looks like a Compose file or a Kubernetes resource, and checks for required fields, correct indentation, and common structural mistakes.

All checking is performed locally in the browser. You can paste a manifest that contains internal image names, secret references, or cluster-specific annotations without uploading it. The linter reports syntax and structural problems; it does not contact a cluster or a Docker daemon.

Docker Compose checks

For Compose files the linter looks for a version or the newer compose specification markers and then examines each service. It verifies that services are mappings, that image or build is present, and that ports, volumes, and environment entries have the expected shapes.

Unknown top-level keys produce warnings. The tool does not expand variable interpolation; it only checks the static structure you pasted.

Kubernetes manifest checks

Kubernetes documents are recognized by the presence of apiVersion, kind, and metadata. The linter confirms that metadata.name exists, that the kind is a non-empty string, and that spec is an object when the resource type normally requires one.

Multi-document YAML (separated by ---) is supported. Each document is validated independently and errors are reported with the document index.

YAML syntax versus semantic rules

First the input must be valid YAML. Indentation errors, tabs, or unquoted special characters stop processing immediately and the line number is shown. Once the YAML parses, the structural rules above are applied.

The linter does not know every Kubernetes API version or every Compose extension field. It catches the most frequent mistakes that prevent a file from being accepted by docker-compose or kubectl, but it is not a full schema validator.

When to use this tool

  • Checking a Compose file before running docker-compose up
  • Validating a Kubernetes manifest before kubectl apply
  • Finding indentation or missing-field errors in a generated YAML
  • Reviewing a multi-document manifest for structural problems
  • Teaching the required top-level keys of each format

How to use the Docker & Kubernetes YAML Linter

  1. Paste the YAML into the input area.
  2. Click Lint / Validate.
  3. Read any syntax errors first and correct indentation or quoting.
  4. Address structural warnings (missing name, missing image, etc.).
  5. For multi-document input, note which document index the message refers to.
  6. Copy the cleaned YAML back to your editor or repository.
  7. Clear the input when finished.

Worked examples

Valid minimal Compose service

Input
services:\n  web:\n    image: nginx:alpine\n    ports:\n      - "80:80"
Output
Valid Docker Compose fragment\nService web: image present, ports defined

Modern Compose files may omit the version key; the linter accepts this.

Kubernetes Deployment missing name

Input
apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: demo\nspec:\n  replicas: 1
Output
Error: metadata.name is required

Every Kubernetes object needs a name inside metadata.

Common mistakes and tips

  • Use spaces for indentation; tabs are a common source of YAML parse failures.
  • Quote port mappings and environment values that contain colons or special characters.
  • For multi-document files, keep the --- separators on their own lines.
  • If the linter says the document is valid but kubectl rejects it, the problem is likely an API-version or schema detail the linter does not cover.
  • Format the YAML with the YAML Formatter first if the structure is hard to read.

Frequently asked questions

Does it talk to a Kubernetes cluster?

No. Validation is purely structural and occurs in the browser.

Can it validate Helm templates?

Only after you render them. Raw Helm templates contain {{ }} actions that are not valid YAML.

What Compose versions are recognized?

Both the classic versioned format and the current Compose specification (no version key) are accepted.

Are custom resource definitions fully checked?

Only the common Kubernetes envelope (apiVersion, kind, metadata, spec) is checked. CRD-specific fields are not validated.

How are multi-document errors reported?

Each error includes the document index (starting at 0) so you know which section to fix.