详细操作请查看 菜鸟教程https://www.runoob.com/docker/docker-swarm.html
- docker swarm init —advertise-addr ‘本机ip(需要其他docker工作节点可以访问到)’ 该命令将本节点的docker更改管理节点。
注意:ip为内网ip时 改命令会报错如下
Error response from daemon: must specify a listening address because the address to advertise is not recognized as a system address, and a system’s IP address to use could not be uniquely identified
解决方法:
docker swarm init —advertise-addr ip —listen-addr 127.0.0.1
2.执行该命令后请复制红框内的内容
3.在其他docker机器上执行红框内的命令向管理节点注册工作节点
4.在管理节点的docker机器上执行docker info