Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 700
Knows Not Much Avatar asked May 25 '16 02:05

Knows Not Much


People also ask

Can you use Docker with EC2?

You can run Docker containers on AWS EC2 by installing Docker. You need to install Docker CLI, AWS account setup and you need to create an IAM user as an administrator. You can pull Docker images from Docker Hub and when you run those containers you should expose on port 80.

Is Docker compatible with AWS?

AWS provides support for both Docker open-source and commercial solutions. There are a number of ways to run containers on AWS, including Amazon Elastic Container Service (ECS) is a highly scalable, high performance container management service.


1 Answers

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
like image 180
Knows Not Much Avatar answered Sep 24 '22 13:09

Knows Not Much