Docker 堆栈部署
描述 | 部署新堆栈或更新现有堆栈 |
---|---|
用法 | docker stack deploy [OPTIONS] STACK |
别名 | docker stack up |
群此命令适用于 Swarm 编排器。
描述
从 swarm 上的文件创建和更新堆栈。compose
注意
这是一个集群管理命令,必须在 swarm 上执行 Manager 节点。要了解 Manager 和 worker,请参阅 文档。
选项
选择 | 违约 | 描述 |
---|---|---|
-c, --compose-file | API 1.25+Compose 文件的路径,或从 stdin 读取的路径- | |
-d, --detach | true | 立即退出,而不是等待堆栈服务收敛 |
--prune | API 1.27+删除不再引用的服务 | |
-q, --quiet | Suppress progress 输出 | |
--resolve-image | always | API 1.30+查询注册表以解析镜像摘要和支持的平台 (、、always changed never ) |
--with-registry-auth | 将注册表身份验证详细信息发送到 Swarm 代理 |
例子
编写文件 (--compose-file)
该命令支持 Compose 文件版本及以上版本。deploy
3.0
$ 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
Compose 文件也可以作为标准输入提供:--compose-file -
$ 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
如果您的配置被拆分为多个 Compose 文件,例如基本
configuration 和特定于环境的覆盖,您可以提供多个标志。--compose-file
$ 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
您可以验证服务是否已正确创建:
$ 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