From 522420ef341a6105325fa25f41463d21ce33bcc8 Mon Sep 17 00:00:00 2001 From: Bret Fisher Date: Wed, 2 May 2018 23:18:19 -0400 Subject: [PATCH 1/2] Updating some compose info for devs --- slides/intro/Compose_For_Dev_Stacks.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/slides/intro/Compose_For_Dev_Stacks.md b/slides/intro/Compose_For_Dev_Stacks.md index 3a4f22be..917eb91f 100644 --- a/slides/intro/Compose_For_Dev_Stacks.md +++ b/slides/intro/Compose_For_Dev_Stacks.md @@ -60,6 +60,10 @@ Before diving in, let's see a small example of Compose in action. If you are using the official training virtual machines, Compose has been pre-installed. +If you are using Docker for Mac/Windows or the Toolbox, docker-compose comes with them. + +If you're on Linux desktop/server, you'll need to get the lastest at https://github.com/docker/compose/releases + You can always check that it is installed by running: ```bash @@ -137,21 +141,23 @@ services: ## Compose file versions -Version 1 directly has the various containers (`www`, `redis`...) at the top level of the file. +Version 1 (or no version) is legacy and shouldn't be used. Version 2 has multiple sections: -* `version` is mandatory and should be `"2"`. +* `version` is mandatory and should be `"2"` or later. -* `services` is mandatory and corresponds to the content of the version 1 format. +* `services` is mandatory. A service is one or more replicas of the same image running as containers. * `networks` is optional and indicates to which networks containers should be connected. -
(By default, containers will be connected on a private, per-app network.) +
(By default, containers will be connected on a private, per-compose-file network.) * `volumes` is optional and can define volumes to be used and/or shared by the containers. Version 3 adds support for deployment options (scaling, rolling updates, etc.) +Docker Docs has good info on versions https://docs.docker.com/compose/compose-file/ + --- ## Containers in `docker-compose.yml` @@ -260,6 +266,8 @@ Removing trainingwheels_www_1 ... done Removing trainingwheels_redis_1 ... done ``` +Use `docker-compose down -v` to remove everything including volumes. + --- ## Special handling of volumes From d6e19fe350e7367be4b6ce1acb52cc99cc5a0bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Sat, 5 May 2018 05:39:25 -0500 Subject: [PATCH 2/2] Update Compose_For_Dev_Stacks.md --- slides/intro/Compose_For_Dev_Stacks.md | 27 +++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/slides/intro/Compose_For_Dev_Stacks.md b/slides/intro/Compose_For_Dev_Stacks.md index 917eb91f..39065520 100644 --- a/slides/intro/Compose_For_Dev_Stacks.md +++ b/slides/intro/Compose_For_Dev_Stacks.md @@ -60,9 +60,9 @@ Before diving in, let's see a small example of Compose in action. If you are using the official training virtual machines, Compose has been pre-installed. -If you are using Docker for Mac/Windows or the Toolbox, docker-compose comes with them. +If you are using Docker for Mac/Windows or the Docker Toolbox, Compose comes with them. -If you're on Linux desktop/server, you'll need to get the lastest at https://github.com/docker/compose/releases +If you are on Linux (desktop or server environment), you will need to install Compose from its [release page](https://github.com/docker/compose/releases) or with `pip install docker-compose`. You can always check that it is installed by running: @@ -139,13 +139,11 @@ services: --- -## Compose file versions +## Compose file structure -Version 1 (or no version) is legacy and shouldn't be used. +A Compose file has multiple sections: -Version 2 has multiple sections: - -* `version` is mandatory and should be `"2"` or later. +* `version` is mandatory. (We should use `"2"` or later; version 1 is deprecated.) * `services` is mandatory. A service is one or more replicas of the same image running as containers. @@ -154,9 +152,20 @@ Version 2 has multiple sections: * `volumes` is optional and can define volumes to be used and/or shared by the containers. -Version 3 adds support for deployment options (scaling, rolling updates, etc.) +--- -Docker Docs has good info on versions https://docs.docker.com/compose/compose-file/ +## Compose file versions + +* Version 1 is legacy and shouldn't be used. + + (If you see a Compose file without `version` and `services`, it's a legacy v1 file.) + +* Version 2 added support for networks and volumes. + +* Version 3 added support for deployment options (scaling, rolling updates, etc). + +The [Docker documentation](https://docs.docker.com/compose/compose-file/) +has excellent information about the Compose file format if you need to know more about versions. ---