Formatting Errors in YAML Files
Learn what YAML files are and how to format them.
Overview of YAML files
YAML (yet another markup language) can be defined as readable data that’s used for configuration, application setup, and data exchange. They contain data in a structured format. The data is either organized into key-value pairs, data structures, or lists. They’re much easier to understand than other data-readable formats such as XML or JSON. As explained, they’re mostly for configurational purposes, i.e., setting up environmental and other needed setup in an application. An example of a YAML file can be seen below:
name: Frankage: 30address:street: St Johncity: Cowboystate: Texas
Aside from configuration setup for applications, they’re also used for storing key-value pairs, just like the information we have above. One of the greatest benefits of using YAML files over other formats is that they’re much easier to use for both humans and machines.
The relationship between Docker and YAML
Docker makes use of YAML files a lot for defining and configuring containers. Its use case is majorly applied when using Docker Compose (a tool that manages Docker containers). Aside from Docker Compose usage of YAML files, Docker uses YAML files to define configuration in Docker containers such as base image, environment variables, ports, and commands to start up the containers.
An example of a Docker Compose file ...