2017-11-10 198 views
0

试图在一个EC2实例指向一个群主来使用另一个EC2实例领事注册表时,我收到以下错误:无法在EC2上指向群师傅领事注册表上的另一个EC2

Running pre-create checks... 
Creating machine... 
(swarm-master) Launching instance... 
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(systemd)... 
Installing Docker... 
Copying certs to the local machine directory... 
Copying certs to the remote machine... 
Setting Docker configuration on the remote daemon... 
Error creating machine: Error running provisioning: ssh command error: 
command : sudo systemctl -f start docker 
err  : exit status 1 
output : Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details. 

我注意到了直接指向码头引擎位置的提示,升级到最新的码头机版本,并在注册表EC2的安全组上打开了端口8500,但这并未解决我的问题。

这里是我如何运行:

创建注册表:

docker-machine create \ 
     --driver amazonec2 \ 
     --amazonec2-vpc-id vpc-12345678 \ 
     --amazonec2-region us-east-1 \ 
     --amazonec2-zone b \ 
     --amazonec2-instance-type t2.micro \ 
     --amazonec2-subnet-id subnet-12345678 \ 
     --amazonec2-security-group swarm_sg \ 
     --amazonec2-keypair-name swarm \ 
     --amazonec2-ssh-keypath ~/.docker/machine/certs/swarm \ 
     swarm-registry 

承担注册表机

eval $(docker-machine env swarm-registry) 

运行领事

docker run -d \ 
     -p "8500:8500" \ 
     -h "consul" \ 
     progrium/consul -server -bootstrap 

创建群主:

docker-machine create \ 
     --driver amazonec2 \ 
     --amazonec2-vpc-id vpc-12345678 \ 
     --amazonec2-region us-east-1 \ 
     --amazonec2-zone b \ 
     --amazonec2-instance-type t2.micro \ 
     --amazonec2-subnet-id subnet-12345678 \ 
     --amazonec2-security-group swarm_sg \ 
     --amazonec2-keypair-name swarm \ 
     --amazonec2-ssh-keypath ~/.docker/machine/certs/swarm \ 
     --engine-install-url="https://web.archive.org/web/20170623081500/https://get.docker.com" \ 
     --swarm \ 
     --swarm-master \ 
     --swarm-discovery="consul://172.31.56.214:8500" \ 
     --engine-opt="cluster-store=consul://172.31.56.214:8500" \ 
     --engine-opt="cluster-advertise=eth1:2376" \ 
     swarm-master 

其中172.31.56.214是swarm-registry机器的主机EC2的私有IP地址。此外,当运行W/O试图指向领事我没有问题。也就是说,创建没有以下行的主人是可能的:

 --swarm-discovery="consul://172.31.56.214:8500" \ 
     --engine-opt="cluster-store=consul://172.31.56.214:8500" \ 
     --engine-opt="cluster-advertise=eth1:2376" \ 

任何帮助真诚赞赏。

回答

0

我的问题是我的网络接口名称不是eth1。这是eth0。另外,我想了解AWS接口的命名方式。它们在我们的EC2实例类型中看起来有所不同(例如eth0,eth1,ens3)。