无外网环境下,docker-machine部署swarm集群,ip改变


背景:
使用docker-machine,swarm(consul发现)在外网环境下搭建了一个生产集群,集群配置:
在pc上安装4个虚拟机,角色为:
docker-machine(部署集群,运行私有仓库)
consul服务节点(集群发现服务)
swarm-master节点(集群管理)
swarm-node节点(运行生产容器)
搭建顺利.

需求:
搭建生产环境时,先在外网环境,最终运行在内网环境(无法访问docker hub),且外网转内网时,发生ip改变.

问题:
搭建生产环境时,预先在外网做了必要准备,转换到内网时,使用docker-machine如下语句创建master节点
root@product-docker-machine:~# docker-machine create -d generic --generic-ip-address=192.168.198.133 --swarm --swarm-master --swarm-discovery="consul://$(docker-machine ip consul):8500" --engine-opt="cluster-store=consul://$(docker-machine ip consul):8500" --engine-opt="cluster-advertise=eth0:2376" --engine-opt="insecure-registry=192.168.198.135:5000" master
返回结果
Running pre-create checks...
Creating machine...
(master) No SSH key specified. Connecting to this machine now and in the future will require the ssh agent to contain the appropriate key.
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with ubuntu(upstart)...
Installing Docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Configuring swarm...
Error creating machine: Error running provisioning: Unable to pull image: Network timed out while trying to connect to https://index.docker.io/v1/rep ... ages. You may want to check your internet connection or if you are behind a proxy.
说明:
192.168.198.133:待部署master节点
192.168.198.135:5000:内网registry私有仓库

分析与尝试:
分析:问题是在创建swarm-master节点时,从外网pull了swarm镜像导致.
尝试1:待部署master节点提前下载好swarm镜像
尝试2:向私有仓库中push了swarm镜像,在原语句中添加--engine-opt="selinux-enabled",并确认master节点可以在machine部署swarm-master前从仓库中下载该镜像
以上两个尝试后,问题仍存在.
ps:该问题在用machine部署consul服务时没有出现.

版半信息:
root@product-docker-machine:~# docker version
Client:
Version: 1.11.0
API version: 1.23
Go version: go1.5.4
Git commit: 4dc5990
Built: Wed Apr 13 18:34:23 2016
OS/Arch: linux/amd64

Server:
Version: 1.11.0
API version: 1.23
Go version: go1.5.4
Git commit: 4dc5990
Built: Wed Apr 13 18:34:23 2016
OS/Arch: linux/amd64

root@product-docker-machine:~# docker-machine version
docker-machine version 0.6.0, build e27fb87

请教各位~
已邀请:

要回复问题请先登录注册