一:创建swarm-manager
1 .右击docker的运行图标切换docker容器运行的环境 到Switch to Windows containers
docker swarm init —advertise-addr ip
注意: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
如果初始化完成后 子工作节点无法连接,管理员模式是下执行如下命令,防火墙开发如下端口
netsh advfirewall firewall add rule name=”swm 2377” dir=in action=allow protocol=TCP localport=2377
netsh advfirewall firewall add rule name=”swm 7946” dir=in action=allow protocol=TCP localport=7946
netsh advfirewall firewall add rule name=”swm 7946udp” dir=in action=allow protocol=UDP localport=7946
netsh advfirewall firewall add rule name=”swm 4789” dir=in action=allow protocol=TCP localport=4789
netsh advfirewall firewall add rule name=”swm 4789udp” dir=in action=allow protocol=UDP localport=4789
注意:所有功能都准备就绪后,在Windows containers 模式下跑了个mysql测试结果显示找不到 适用于windows的版本,
放弃改方案。改用linux系统下运行