Integrating Docker-Machine with Amazon EC2

谁都会走 提交于 2020-03-21 19:23:09

问题


I am reading this article which shows me how I can configure my docker VM on top of amazon ec2

https://docs.docker.com/machine/drivers/aws/

I got to the step

docker-machine create --driver amazonec2 aws01

but now I get an error

Error with pre-create check: "unable to find a subnet in the zone: us-east-1a"

I googled and found this thread

https://github.com/docker/machine/issues/1771

but did find anything which worked for me.

Has anyone been able to successfully create a VM on top of AWS using docker-machine?


回答1:


I solved it myself. putting the answer here

first do

aws configure

This will ask you some questions like security id and key. you should be able to get this information from the aws dashboard.

aws ec2 describe-subnets

This will list a bunch of subnet information. Just look at the first one and make note of AvailabilityZone and Subnet Id

docker-machine create --driver amazonec2 --amazonec2-subnet-id=xxxx --amazonec2-zone=c aws01

Here enter the subnet ID you noted from step two and only the last character of the Availability Zone (so if the value is us-east-1c just enter c)

Now you will see

Running pre-create checks...
Creating machine...
(aws01) 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...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env aws01


来源:https://stackoverflow.com/questions/37426933/integrating-docker-machine-with-amazon-ec2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!