配置所在网站,在Run you app in production下面的Configure containers里面的Scale your app就有Swarm相关的内容嗷!!!
工作原理:
上面用于操作的结点,至少要有3台嗷!!!
搭建集群实例:
swarm相关命令:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
[root@VM-12-10-centos ~]# docker swarm --help
Usage: docker swarm COMMAND
Manage Swarm
Commands: ca Display and rotate the root CA init Initialize a swarm join Join a swarm as a node and/or manager join-token Manage join tokens leave Leave the swarm unlock Unlock swarm unlock-key Manage the unlock key update Update the swarm
Run 'docker swarm COMMAND --help' for more information on a command.
Commands: ca Display and rotate the root CA init Initialize a swarm join Join a swarm as a node and/or manager join-token Manage join tokens leave Leave the swarm unlock Unlock swarm unlock-key Manage the unlock key update Update the swarm
Run 'docker swarm COMMAND --help' for more information on a command. [root@VM-12-10-centos ~]# docker swarm init --help
Usage: docker swarm init [OPTIONS]
Initialize a swarm
Options: --advertise-addr string Advertised address (format: <ip|interface>[:port]) --autolock Enable manager autolocking (requiring an unlock key to start a stopped manager) --availability string Availability of the node ("active"|"pause"|"drain") (default "active") --cert-expiry duration Validity period for node certificates (ns|us|ms|s|m|h) (default 2160h0m0s) --data-path-addr string Address or interface to use for data path traffic (format: <ip|interface>) --data-path-port uint32 Port number to use for data path traffic (1024 - 49151). If no value is set or is set to 0, the default port (4789) is used. --default-addr-pool ipNetSlice default address pool in CIDR format (default []) --default-addr-pool-mask-length uint32 default address pool subnet mask length (default 24) --dispatcher-heartbeat duration Dispatcher heartbeat period (ns|us|ms|s|m|h) (default 5s) --external-ca external-ca Specifications of one or more certificate signing endpoints --force-new-cluster Force create a new cluster from current state --listen-addr node-addr Listen address (format: <ip|interface>[:port]) (default 0.0.0.0:2377) --max-snapshots uint Number of additional Raft snapshots to retain --snapshot-interval uint Number of log entries between Raft snapshots (default 10000) --task-history-limit int Task history retention limit (default 5)
Commands: create Create a new service inspect Display detailed information on one or more services logs Fetch the logs of a service or task ls List services ps List the tasks of one or more services rm Remove one or more services rollback Revert changes to a service's configuration scale Scale one or multiple replicated services update Update a service
Run 'docker service COMMAND --help' for more information on a command.
拥有创建服务,动态拓展服务,动态更新服务等功能。
概念:
灰度发布
金丝雀发布
创建一个服务:
docker service create -p 8080:80 --name my-nginx nginx
Options: --orchestrator string Orchestrator to use (swarm|kubernetes|all)
Commands: deploy Deploy a new stack or update an existing stack ls List stacks ps List the tasks in the stack rm Remove one or more stacks services List the services in the stack
Run 'docker stack COMMAND --help' for more information on a command. [root@VM-12-10-centos ~]# docker stack
Usage: docker stack [OPTIONS] COMMAND
Manage Docker stacks
Options: --orchestrator string Orchestrator to use (swarm|kubernetes|all)
Commands: deploy Deploy a new stack or update an existing stack ls List stacks ps List the tasks in the stack rm Remove one or more stacks services List the services in the stack
Run 'docker stack COMMAND --help' for more information on a command.
Docker Secret
密码啊,证书的之类的
1 2 3 4 5 6 7 8 9 10 11 12 13
[root@VM-12-10-centos ~]# docker secret
Usage: docker secret COMMAND
Manage Docker secrets
Commands: create Create a secret from a file or STDIN as content inspect Display detailed information on one or more secrets ls List secrets rm Remove one or more secrets
Run 'docker secret COMMAND --help' for more information on a command.
Docker Config
Docker对于容器的统一的一些配置嗷!!!
1 2 3 4 5 6 7 8 9 10 11 12 13 14
[root@VM-12-10-centos ~]# docker config
Usage: docker config COMMAND
Manage Docker configs
Commands: create Create a config from a file or STDIN inspect Display detailed information on one or more configs ls List configs rm Remove one or more configs
Run 'docker config COMMAND --help' for more information on a command. [root@VM-12-10-centos ~]#