我正在阅读这篇文章,它向我展示了如何在amazon ec2上配置我的docker VM
https://docs.docker.com/machine/drivers/aws/
我走到了步骤
docker-machine create --driver amazonec2 aws01
但现在我收到错误
Error with pre-create check: "unable to find a subnet in the zone: us-east-1a"
我用Google搜索并找到了这个帖子
https://github.com/docker/machine/issues/1771
但确实找到了对我有用的任何东西。
是否有人能够使用docker-machine在AWS上成功创建VM?
答案 0 :(得分:10)
我自己解决了。把答案放在这里
首先做
aws configure
这会问你一些安全ID和密钥等问题。您应该能够从aws仪表板获取此信息。
aws ec2 describe-subnets
这将列出一堆子网信息。只需查看第一个并记下AvailabilityZone和Subnet Id
即可docker-machine create --driver amazonec2 --amazonec2-subnet-id=xxxx --amazonec2-zone=c aws01
此处输入您在步骤2中记下的子网ID,并且只输入可用区的最后一个字符(如果值为us-east-1c则输入c)
现在你会看到
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