-
Notifications
You must be signed in to change notification settings - Fork 10
Deploy to AWS using docker machine and docker compose
Julian Espinel edited this page Jan 7, 2017
·
9 revisions
Please follow this steps:
- Install docker in your localhost. Installation link
- Install docker-machine in your localhost. Installation link
- Install docker-compose in your localhost. Installation link
- Create an account in AWS (skip this step if you already have one). AWS
- Create the AWS credentials file in your localhost. docker-machine + aws
- Log into aws and get your VPC ID
- Go to: https://console.aws.amazon.com/vpc/
- Click on the VPC link
- Copy your VPC ID
Please write this commands in your terminal:
docker-machine create -d amazonec2 --amazonec2-vpc-id <your-vpc-id> --amazonec2-ami ami-e13739f6 stockreader
docker-machine env stockreader
-
eval $(docker-machine env stockreader)
(From now on all docker, docker-machine and docker-compose commands will point to the AWS EC2 instance) -
git clone https://github.com/julianespinel/stockreader.git
(clone the project in your localhost) cd stockreader
docker-compose build
docker-compose up -d
Please follow this steps:
- Go to your AWS EC2
- Click on the "running instances" link
- Copy the public IP of the stockreader instance
- Check the security group applied to the instance allows inbound TCP traffic to the port 5000
- On your browser go to:
http://<stockreader-instance-public-ip>:5000/stockreader/admin/ping
If you get the following JSON, congratulations! You just deployed Stockreader to AWS using docker-machine and docker compose:
{
"message": "pong"
}