mirror of https://github.com/docker/docs.git
improved Compose v3 and surrounding intro topics and links
Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
This commit is contained in:
parent
426ea700ce
commit
2c302845e1
|
@ -58,6 +58,24 @@ Each service will run in its own container. Using swarm mode,
|
||||||
we can also scale the application to deploy replicas
|
we can also scale the application to deploy replicas
|
||||||
of containerized services distributed across multiple nodes.
|
of containerized services distributed across multiple nodes.
|
||||||
|
|
||||||
|
Here is an example of one of the services fully defined:
|
||||||
|
|
||||||
|
```
|
||||||
|
vote:
|
||||||
|
image: dockersamples/examplevotingapp_vote:before
|
||||||
|
ports:
|
||||||
|
- 5000:80
|
||||||
|
networks:
|
||||||
|
- frontend
|
||||||
|
depends_on:
|
||||||
|
- redis
|
||||||
|
deploy:
|
||||||
|
replicas: 2
|
||||||
|
update_config:
|
||||||
|
parallelism: 2
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
```
|
||||||
|
|
||||||
The `image` key defines which image the service will use. The `vote` service
|
The `image` key defines which image the service will use. The `vote` service
|
||||||
uses `dockersamples/examplevotingapp_vote:before`.
|
uses `dockersamples/examplevotingapp_vote:before`.
|
||||||
|
@ -66,6 +84,10 @@ The `depends_on` key allows you to specify that a service is only
|
||||||
deployed after another service. In our example, `vote` only deploys
|
deployed after another service. In our example, `vote` only deploys
|
||||||
after `redis`.
|
after `redis`.
|
||||||
|
|
||||||
|
The `deploy` key specifies aspects of a swarm deployment, as described below in
|
||||||
|
[Compose v.3 features and
|
||||||
|
compatibility](#compose-v3-features-and-compatibility).
|
||||||
|
|
||||||
## docker-stack.yml
|
## docker-stack.yml
|
||||||
|
|
||||||
We'll deploy the app using `docker-stack.yml`, which is a
|
We'll deploy the app using `docker-stack.yml`, which is a
|
||||||
|
@ -76,8 +98,8 @@ To follow along with the example, you need only have
|
||||||
Docker running and the copy of `docker-stack.yml` we
|
Docker running and the copy of `docker-stack.yml` we
|
||||||
provide here. This file defines all the services shown
|
provide here. This file defines all the services shown
|
||||||
in the [table above](#anatomy-of-the-voting-app), their
|
in the [table above](#anatomy-of-the-voting-app), their
|
||||||
base images, configuration details such as ports
|
base images, configuration details such as ports and networks,
|
||||||
and dependencies, and the swarm configuration.
|
application dependencies, and the swarm configuration.
|
||||||
|
|
||||||
```
|
```
|
||||||
version: "3"
|
version: "3"
|
||||||
|
@ -176,7 +198,7 @@ with this `docker-stack.yml` file to pull the referenced images and launch the
|
||||||
services in a swarm as configured in the `.yml`.
|
services in a swarm as configured in the `.yml`.
|
||||||
|
|
||||||
Note that at the top of the `docker-stack.yml` file, the version is indicated as
|
Note that at the top of the `docker-stack.yml` file, the version is indicated as
|
||||||
`version: "3" `. This voting app example relies on Compose version 3, which is
|
`version: "3" `. The voting app example relies on Compose version 3, which is
|
||||||
designed to be cross-compatible with Compose and Docker Engine swarm mode.
|
designed to be cross-compatible with Compose and Docker Engine swarm mode.
|
||||||
|
|
||||||
Before we get started, let's take a look at some aspects of Compose files and
|
Before we get started, let's take a look at some aspects of Compose files and
|
||||||
|
@ -186,7 +208,7 @@ this walkthrough.
|
||||||
- [docker-stack.yml](#docker-stackyml)
|
- [docker-stack.yml](#docker-stackyml)
|
||||||
- [deploy key](#deploy-key)
|
- [deploy key](#deploy-key)
|
||||||
- [docker stack deploy command](#docker-stack-deploy-command)
|
- [docker stack deploy command](#docker-stack-deploy-command)
|
||||||
- [Application stacks and services](#application-stacks-and-services)
|
- [Application stacks and services](#application-stack-and-services)
|
||||||
|
|
||||||
### docker-stack.yml
|
### docker-stack.yml
|
||||||
|
|
||||||
|
@ -195,7 +217,7 @@ v.3.
|
||||||
|
|
||||||
#### deploy key
|
#### deploy key
|
||||||
|
|
||||||
The `deploy` key is new in v.3, and allows you to specify various properties of
|
The `deploy` key allows you to specify various properties of
|
||||||
a swarm deployment.
|
a swarm deployment.
|
||||||
|
|
||||||
For example, the voting app configuration uses this to
|
For example, the voting app configuration uses this to
|
||||||
|
@ -219,21 +241,24 @@ with `docker stack deploy`.
|
||||||
* It can take the place of running `docker compose up` to deploy
|
* It can take the place of running `docker compose up` to deploy
|
||||||
v.3 compatible applications.
|
v.3 compatible applications.
|
||||||
|
|
||||||
### Application stack and services
|
### Application stacks and services
|
||||||
|
|
||||||
Taken together, these new features and deployment options can help when
|
Taken together, these new features and deployment options can help when
|
||||||
mapping out distributed applications and clustering strategies. Rather than
|
mapping out distributed applications and clustering strategies. Rather than
|
||||||
thinking about running individual containers, perse, we can start to model
|
thinking about running individual containers, we can start to model
|
||||||
Docker deployments as an application stack and services.
|
Docker deployments as application stacks and services.
|
||||||
|
|
||||||
For more about `docker-stack.yml` and the `docker stack deploy` command, see
|
### Compose file reference
|
||||||
[deploy](/compose/compose-file.md#deploy) in the [Compose file
|
|
||||||
reference](/compose/compose-file.md).
|
|
||||||
|
|
||||||
For more about what's new in Compose v.3, see
|
To learn more, see these topics in the [Compose file
|
||||||
[Versioning](/compose/compose-file.md#versioning)) and
|
reference](/compose/compose-file.md):
|
||||||
[Upgrading](/compose/compose-file.md#upgrading)) in the [Compose file
|
|
||||||
reference](/compose/compose-file.md)
|
* For more about `docker-stack.yml` and the `docker stack deploy` command, see
|
||||||
|
[deploy](/compose/compose-file.md#deploy).
|
||||||
|
|
||||||
|
* For more on what's new in Compose v.3, see
|
||||||
|
[Versioning](/compose/compose-file.md#versioning), [Version 3](/compose/compose-file.md#version-3), and
|
||||||
|
[Upgrading](/compose/compose-file.md#upgrading).
|
||||||
|
|
||||||
## What's next?
|
## What's next?
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue