Skip to content

Latest commit

 

History

History
57 lines (29 loc) · 2.07 KB

Readme.md

File metadata and controls

57 lines (29 loc) · 2.07 KB

YAML & Docker Compose

YAML

Introduction

  • I was about to start the class on Docker Compose, but was advised to get familiar with YAML first, so here I am.

Use Case

  • Docker configuration

Cloud Research

  • A YAML file is used to represent data, in this case, configuration data.

XML, JSON, YAML syntax

  • As in Python, indentation, whitespace - matters.

XML, JSON, YAML syntax

differences between YAML data structures

Docker Compose

Use Case

If you wanted to set up a complex application running multiple services, a best practice is to use Docker compose (rather than run). This is easier to implement, run and maintain, as all changes are always stored in the docker-compose config file. However, this is only applicable to running containers on a single Docker host.

run vs compose

Cloud Research

  • Can create a configuration file in YAML format called docker-compose.yml, putting together the different services and the options specific to running them.

  • docker-compose up brings up the entire application stack.

  • docker run --link has been deprecated, but worth having a look at, even as it gets replaced by advanced features such as Docker Swarm and networking

  • Use the run commands to make your compose file, then use docker-compose up to bring up the stack

from run to compose

  • N.B. There are three versions of docker-compose.

versions 1-3 of docker compose

  • Here's an example of how the Docker compose file relates to the application architecture:

docker compose file and app architecure

Social Proof

Twitter