195 lines
6.8 KiB
YAML
195 lines
6.8 KiB
YAML
command: docker stack deploy
|
|
aliases: up
|
|
short: Deploy a new stack or update an existing stack
|
|
long: |-
|
|
Create and update a stack from a `compose` file on the swarm.
|
|
|
|
> **Note**
|
|
>
|
|
> This is a cluster management command, and must be executed on a swarm
|
|
> manager node. To learn about managers and workers, refer to the
|
|
> [Swarm mode section](https://docs.docker.com/engine/swarm/) in the
|
|
> documentation.
|
|
usage: docker stack deploy [OPTIONS] STACK
|
|
pname: docker stack
|
|
plink: docker_stack.yaml
|
|
options:
|
|
- option: bundle-file
|
|
value_type: string
|
|
description: Path to a Distributed Application Bundle file
|
|
deprecated: false
|
|
experimental: true
|
|
experimentalcli: false
|
|
kubernetes: false
|
|
swarm: true
|
|
- option: compose-file
|
|
shorthand: c
|
|
value_type: stringSlice
|
|
default_value: '[]'
|
|
description: Path to a Compose file, or "-" to read from stdin
|
|
deprecated: false
|
|
min_api_version: "1.25"
|
|
experimental: false
|
|
experimentalcli: false
|
|
kubernetes: false
|
|
swarm: false
|
|
- option: namespace
|
|
value_type: string
|
|
description: Kubernetes namespace to use
|
|
deprecated: false
|
|
experimental: false
|
|
experimentalcli: false
|
|
kubernetes: true
|
|
swarm: false
|
|
- option: prune
|
|
value_type: bool
|
|
default_value: "false"
|
|
description: Prune services that are no longer referenced
|
|
deprecated: false
|
|
min_api_version: "1.27"
|
|
experimental: false
|
|
experimentalcli: false
|
|
kubernetes: false
|
|
swarm: true
|
|
- option: resolve-image
|
|
value_type: string
|
|
default_value: always
|
|
description: |
|
|
Query the registry to resolve image digest and supported platforms ("always"|"changed"|"never")
|
|
deprecated: false
|
|
min_api_version: "1.30"
|
|
experimental: false
|
|
experimentalcli: false
|
|
kubernetes: false
|
|
swarm: true
|
|
- option: with-registry-auth
|
|
value_type: bool
|
|
default_value: "false"
|
|
description: Send registry authentication details to Swarm agents
|
|
deprecated: false
|
|
experimental: false
|
|
experimentalcli: false
|
|
kubernetes: false
|
|
swarm: true
|
|
inherited_options:
|
|
- option: kubeconfig
|
|
value_type: string
|
|
description: Kubernetes config file
|
|
deprecated: false
|
|
experimental: false
|
|
experimentalcli: false
|
|
kubernetes: true
|
|
swarm: false
|
|
- option: orchestrator
|
|
value_type: string
|
|
description: Orchestrator to use (swarm|kubernetes|all)
|
|
deprecated: false
|
|
experimental: false
|
|
experimentalcli: false
|
|
kubernetes: false
|
|
swarm: false
|
|
examples: |-
|
|
### Compose file
|
|
|
|
The `deploy` command supports compose file version `3.0` and above.
|
|
|
|
```bash
|
|
$ docker stack deploy --compose-file docker-compose.yml vossibility
|
|
|
|
Ignoring unsupported options: links
|
|
|
|
Creating network vossibility_vossibility
|
|
Creating network vossibility_default
|
|
Creating service vossibility_nsqd
|
|
Creating service vossibility_logstash
|
|
Creating service vossibility_elasticsearch
|
|
Creating service vossibility_kibana
|
|
Creating service vossibility_ghollector
|
|
Creating service vossibility_lookupd
|
|
```
|
|
|
|
The Compose file can also be provided as standard input with `--compose-file -`:
|
|
|
|
```bash
|
|
$ cat docker-compose.yml | docker stack deploy --compose-file - vossibility
|
|
|
|
Ignoring unsupported options: links
|
|
|
|
Creating network vossibility_vossibility
|
|
Creating network vossibility_default
|
|
Creating service vossibility_nsqd
|
|
Creating service vossibility_logstash
|
|
Creating service vossibility_elasticsearch
|
|
Creating service vossibility_kibana
|
|
Creating service vossibility_ghollector
|
|
Creating service vossibility_lookupd
|
|
```
|
|
|
|
If your configuration is split between multiple Compose files, e.g. a base
|
|
configuration and environment-specific overrides, you can provide multiple
|
|
`--compose-file` flags.
|
|
|
|
```bash
|
|
$ docker stack deploy --compose-file docker-compose.yml -c docker-compose.prod.yml vossibility
|
|
|
|
Ignoring unsupported options: links
|
|
|
|
Creating network vossibility_vossibility
|
|
Creating network vossibility_default
|
|
Creating service vossibility_nsqd
|
|
Creating service vossibility_logstash
|
|
Creating service vossibility_elasticsearch
|
|
Creating service vossibility_kibana
|
|
Creating service vossibility_ghollector
|
|
Creating service vossibility_lookupd
|
|
```
|
|
|
|
You can verify that the services were correctly created:
|
|
|
|
```bash
|
|
$ docker service ls
|
|
|
|
ID NAME MODE REPLICAS IMAGE
|
|
29bv0vnlm903 vossibility_lookupd replicated 1/1 nsqio/nsq@sha256:eeba05599f31eba418e96e71e0984c3dc96963ceb66924dd37a47bf7ce18a662
|
|
4awt47624qwh vossibility_nsqd replicated 1/1 nsqio/nsq@sha256:eeba05599f31eba418e96e71e0984c3dc96963ceb66924dd37a47bf7ce18a662
|
|
4tjx9biia6fs vossibility_elasticsearch replicated 1/1 elasticsearch@sha256:12ac7c6af55d001f71800b83ba91a04f716e58d82e748fa6e5a7359eed2301aa
|
|
7563uuzr9eys vossibility_kibana replicated 1/1 kibana@sha256:6995a2d25709a62694a937b8a529ff36da92ebee74bafd7bf00e6caf6db2eb03
|
|
9gc5m4met4he vossibility_logstash replicated 1/1 logstash@sha256:2dc8bddd1bb4a5a34e8ebaf73749f6413c101b2edef6617f2f7713926d2141fe
|
|
axqh55ipl40h vossibility_vossibility-collector replicated 1/1 icecrime/vossibility-collector@sha256:f03f2977203ba6253988c18d04061c5ec7aab46bca9dfd89a9a1fa4500989fba
|
|
```
|
|
|
|
### DAB file
|
|
|
|
```bash
|
|
$ docker stack deploy --bundle-file vossibility-stack.dab vossibility
|
|
|
|
Loading bundle from vossibility-stack.dab
|
|
Creating service vossibility_elasticsearch
|
|
Creating service vossibility_kibana
|
|
Creating service vossibility_logstash
|
|
Creating service vossibility_lookupd
|
|
Creating service vossibility_nsqd
|
|
Creating service vossibility_vossibility-collector
|
|
```
|
|
|
|
You can verify that the services were correctly created:
|
|
|
|
```bash
|
|
$ docker service ls
|
|
|
|
ID NAME MODE REPLICAS IMAGE
|
|
29bv0vnlm903 vossibility_lookupd replicated 1/1 nsqio/nsq@sha256:eeba05599f31eba418e96e71e0984c3dc96963ceb66924dd37a47bf7ce18a662
|
|
4awt47624qwh vossibility_nsqd replicated 1/1 nsqio/nsq@sha256:eeba05599f31eba418e96e71e0984c3dc96963ceb66924dd37a47bf7ce18a662
|
|
4tjx9biia6fs vossibility_elasticsearch replicated 1/1 elasticsearch@sha256:12ac7c6af55d001f71800b83ba91a04f716e58d82e748fa6e5a7359eed2301aa
|
|
7563uuzr9eys vossibility_kibana replicated 1/1 kibana@sha256:6995a2d25709a62694a937b8a529ff36da92ebee74bafd7bf00e6caf6db2eb03
|
|
9gc5m4met4he vossibility_logstash replicated 1/1 logstash@sha256:2dc8bddd1bb4a5a34e8ebaf73749f6413c101b2edef6617f2f7713926d2141fe
|
|
axqh55ipl40h vossibility_vossibility-collector replicated 1/1 icecrime/vossibility-collector@sha256:f03f2977203ba6253988c18d04061c5ec7aab46bca9dfd89a9a1fa4500989fba
|
|
```
|
|
deprecated: false
|
|
min_api_version: "1.25"
|
|
experimental: false
|
|
experimentalcli: false
|
|
kubernetes: false
|
|
swarm: false
|
|
|