Knows Not Much
Knows Not Much

Reputation: 31576

Integrating Docker-Machine with Amazon EC2

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?

Upvotes: 5

Views: 1991

Answers (1)

Knows Not Much
Knows Not Much

Reputation: 31576

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

Upvotes: 13

Related Questions