JAVA全系列 教程
3762个小节阅读:7095.5k
目录
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
使用Docker Service部署服务到Swarm集群
在hub.docker.com上搜索helloworld镜像,用于测试服务
xxxxxxxxxx
[root@localhost ~]# docker pull testcontainers/helloworld
Using default tag: latest
Trying to pull repository docker.io/testcontainers/helloworld ...
latest: Pulling from docker.io/testcontainers/helloworld
df20fa9351a1: Pull complete
7d694ce25b07: Pull complete
99f5116afda5: Pull complete
Digest: sha256:4ee5a832ef6eee533df7224b80d4cceb9ab219599014f408d0b69690be94c396
Status: Downloaded newer image for docker.io/testcontainers/helloworld:latest
在管理节点上执行下面的命令,部署服务到工作节点上
xxxxxxxxxx
docker service create --replicas 3 --name helloworld docker.io/testcontainers/helloworld:latest
查看服务部署情况
查看容器运行日志
xxxxxxxxxx
[root@localhost ~]# docker logs 5710322c635d
02:05:27 DELAY_START_MSEC: 0
02:05:27 Sleeping for 0 ms
02:05:27 Starting server on port 8080
02:05:27 Sleeping for 0 ms
02:05:27 Starting server on port 8081
02:05:27 Ready, listening on 8080 and 8081
删除服务
xxxxxxxxxx
docker service rm helloworld
停止某个节点接收新的任务(在管理节点上执行)
xxxxxxxxxx
docker node update --availability drain node1
或者,重新让某个节点变为可用状态(在管理节点上执行)
xxxxxxxxxx
docker node update --availability active node1
实时效果反馈
1. 关于Docker Swarm说法错误的是?
A Docker Swarm是Docker的集群管理工具
B Swarm由管理节点和工作节点组成
C 创建一个Docker Swarm集群使用docker swarm create 命令
D 在集群节点上执行docker swarm join --token worker|manager,加入集群
答案
1=>C