mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-07-19 21:09:27 +00:00
Updating some compose info for devs
This commit is contained in:
@@ -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.
|
||||
<br/>(By default, containers will be connected on a private, per-app network.)
|
||||
<br/>(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
|
||||
|
||||
Reference in New Issue
Block a user