Menu

8 YAML traps that break Docker, Kubernetes and CI configs (the Norway problem and friends)
📰

8 YAML traps that break Docker, Kubernetes and CI configs (the Norway problem and friends)

DEV Community: docker·Hollis·8 days ago
#KMLbK02p
#devtodocker#devto#dev#yaml#enter
Reading 0:00
15s threshold

YAML looks like the friendliest config format ever, right up until it silently turns your country code into false . These are the YAML traps that break Docker Compose files, Kubernetes manifests, GitHub Actions and Ansible playbooks, and how to avoid each one.

1. Tabs are illegal for indentation

YAML only allows spaces for indentation. A single tab gives errors like:

found character that cannot start any token

Enter fullscreen mode

Exit fullscreen mode

Configure your editor to insert spaces in .yml / .yaml files, and make whitespace visible when debugging.

2. The Norway problem: no is a boolean

In YAML 1.1 (still used by PyYAML, Ruby's Psych, and many tools), these are all booleans: yes , no , on , off , y , n , true , false .

countries : - GB - NO # → false

Enter fullscreen mode

Exit fullscreen mode

Quote anything that's meant to be a string: - "NO" . The same applies to on: in GitHub Actions, which works only because the tool handles it specially.

3.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.