2016-11-23 05:14:38 -05:00
|
|
|
# stack deploy
|
2016-07-19 12:32:44 -04:00
|
|
|
|
2023-01-06 13:04:05 -05:00
|
|
|
<!---MARKER_GEN_START-->
|
2016-11-21 06:36:31 -05:00
|
|
|
Deploy a new stack or update an existing stack
|
2016-07-19 12:32:44 -04:00
|
|
|
|
2023-01-06 13:04:05 -05:00
|
|
|
### Aliases
|
|
|
|
|
|
|
|
`docker stack deploy`, `docker stack up`
|
|
|
|
|
|
|
|
### Options
|
|
|
|
|
|
|
|
| Name | Type | Default | Description |
|
|
|
|
|:---------------------------------------------------------|:--------------|:---------|:--------------------------------------------------------------------------------------------------|
|
|
|
|
| [`-c`](#compose-file), [`--compose-file`](#compose-file) | `stringSlice` | | Path to a Compose file, or `-` to read from stdin |
|
|
|
|
| `--prune` | | | Prune services that are no longer referenced |
|
|
|
|
| `--resolve-image` | `string` | `always` | Query the registry to resolve image digest and supported platforms (`always`, `changed`, `never`) |
|
|
|
|
| `--with-registry-auth` | | | Send registry authentication details to Swarm agents |
|
|
|
|
|
|
|
|
|
|
|
|
<!---MARKER_GEN_END-->
|
2016-07-19 12:32:44 -04:00
|
|
|
|
2017-02-07 18:42:48 -05:00
|
|
|
## Description
|
|
|
|
|
2018-12-23 06:27:52 -05:00
|
|
|
Create and update a stack from a `compose` file on the swarm.
|
|
|
|
|
2020-04-19 11:08:37 -04:00
|
|
|
> **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.
|
2016-07-19 12:32:44 -04:00
|
|
|
|
2017-02-07 18:42:48 -05:00
|
|
|
## Examples
|
|
|
|
|
2023-01-06 13:28:29 -05:00
|
|
|
### <a name="compose-file"></a> Compose file (--compose-file)
|
2016-11-21 06:36:31 -05:00
|
|
|
|
2017-06-21 00:23:21 -04:00
|
|
|
The `deploy` command supports compose file version `3.0` and above.
|
2016-11-21 06:36:31 -05:00
|
|
|
|
2021-08-21 08:54:14 -04:00
|
|
|
```console
|
2016-11-21 06:36:31 -05:00
|
|
|
$ docker stack deploy --compose-file docker-compose.yml vossibility
|
2017-02-07 18:42:48 -05:00
|
|
|
|
2016-11-21 06:36:31 -05:00
|
|
|
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
|
|
|
|
```
|
|
|
|
|
2017-08-22 11:41:12 -04:00
|
|
|
The Compose file can also be provided as standard input with `--compose-file -`:
|
|
|
|
|
2021-08-21 08:54:14 -04:00
|
|
|
```console
|
2017-08-22 11:41:12 -04:00
|
|
|
$ 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
|
|
|
|
```
|
|
|
|
|
2018-02-09 08:19:48 -05:00
|
|
|
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.
|
2017-06-21 00:23:21 -04:00
|
|
|
|
2021-08-21 08:54:14 -04:00
|
|
|
```console
|
2018-04-03 04:11:52 -04:00
|
|
|
$ docker stack deploy --compose-file docker-compose.yml -c docker-compose.prod.yml vossibility
|
2017-06-21 00:23:21 -04:00
|
|
|
|
|
|
|
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:
|
2016-11-21 06:36:31 -05:00
|
|
|
|
2021-08-21 08:54:14 -04:00
|
|
|
```console
|
2016-11-21 06:36:31 -05:00
|
|
|
$ docker service ls
|
2017-02-07 18:42:48 -05:00
|
|
|
|
2016-11-21 06:36:31 -05:00
|
|
|
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
|
2016-07-19 12:32:44 -04:00
|
|
|
```
|
|
|
|
|
2017-02-07 18:42:48 -05:00
|
|
|
## Related commands
|
2016-07-19 12:32:44 -04:00
|
|
|
|
2016-11-14 20:40:44 -05:00
|
|
|
* [stack ls](stack_ls.md)
|
|
|
|
* [stack ps](stack_ps.md)
|
2016-07-19 12:32:44 -04:00
|
|
|
* [stack rm](stack_rm.md)
|
2016-07-20 12:54:48 -04:00
|
|
|
* [stack services](stack_services.md)
|
2020-09-22 05:16:05 -04:00
|
|
|
* [stack config](stack_config.md)
|