root@docker-2:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b88ab2e5eb4e swarm "/swarm join --add..." 4 minutes ago Up 4 minutes 2375/tcp romantic_poincare
root@docker-2:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b88ab2e5eb4e swarm "/swarm join --add..." 4 minutes ago Up 4 minutes 2375/tcp romantic_poincare
root@docker-3:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b88ab2e5eb4e swarm "/swarm join --add..." 4 minutes ago Up 4 minutes 2375/tcp romantic_poincare
root@docker-3:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b88ab2e5eb4e swarm "/swarm join --add..." 4 minutes ago Up 4 minutes 2375/tcp romantic_poincare
用swarm manage命令将docker-1节点配置成为管理节点该命令将启用manager服务,且默认监听到2375端口,所有集群的管理都可以通过该服务的接口进行操作,但是manager服务和docker服务
的监听端口相同,而这样做是为了兼容其他基于docker的服务,可以无缝的切换到swarm平台;但有与本次实验采用的是docker容器的方式启用manager服务,本地的2375端口已被docker daemon占用,
所以将manager服务的端口映射到一个空闲的端口12375
root@docker-1:~# docker run -d -p 12375:2375 swarm manage token://1081dc3745b8dfd45ff863c13d74d96c
ad81e842302de642ba7bf5514b12ce6ea46070abc68c6e15a4eefc0b8e5dfc57
root@docker-1:~# netstat -tunlp |grep docker
tcp6 0 0 :::12375 :::* LISTEN 2191/docker-proxy
tcp6 0 0 :::2375 :::* LISTEN 1698/dockerd
产看docker-1节点运行的容器和所有容器
root@docker-1:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ad81e842302d swarm "/swarm manage tok..." 4 seconds ago Up 3 seconds 0.0.0.0:12375->2375/tcp hungry_benz
fbc0c47268e1 swarm "/swarm join --add..." 19 minutes ago Up 19 minutes 2375/tcp competent_benz
root@docker-1:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ad81e842302d swarm "/swarm manage tok..." 13 seconds ago Up 12 seconds 0.0.0.0:12375->2375/tcp hungry_benz
fbc0c47268e1 swarm "/swarm join --add..." 19 minutes ago Up 19 minutes 2375/tcp competent_benz