Post on 14-Apr-2017
Amazon EC2 Container ServiceTuna
ng.tuna@gmail.com@ngtuna11
http://www.meetup.com/Docker-Hanoi
Docker ecosystemScheduling & Orchestration
• Runandmanageclusterofdockercontainers
• Build-inservicescheduler,taskschedulerandstatemanager
• Orchestrationsystem• IntegratewithmultipleAWSservices.
Amazon EC2 Container Service
ElasticLoadBalancingAmazonElasticBlockStoreAmazonVirtualPrivateCloudAWSIdentityandAccessManagementAWSCloudTrailAWSCloudFormationAWSCloudWatch
Designed for use with other AWS services
Task Definitions{
"environment": [],"name": "simple-demo","image": "my-demo","cpu": 10,"memory": 500,"portMappings": [
{"containerPort": 80,"hostPort": 80
}],"mountPoints": [
{"sourceVolume": "my-vol","containerPath": "/var/www/my-
vol"}
],"entryPoint": [
"/usr/sbin/apache2","-D","FOREGROUND"
],"essential": true
},
{"name": "busybox","image": "busybox","cpu": 10,"memory": 500,"volumesFrom": [{"sourceContainer": "simple-demo"
}],"entryPoint": [
"sh","-c"
],"command": [
"/bin/sh -c \"while true; do /bin/date > /var/www/my-vol/date; sleep 1; done\""
],"essential": false
}
{"environment": [],"name": "simple-demo","image": "my-demo","cpu": 10,"memory": 500,"portMappings": [
{"containerPort": 80,"hostPort": 80
}],"mountPoints": [
{"sourceVolume": "my-vol","containerPath": "/var/www/my-
vol"}
],"entryPoint": [
"/usr/sbin/apache2","-D","FOREGROUND"
],"essential": true
},
Task Definitions[
{"image": "mysql","name": "db","cpu": 10,"memory": 500,"essential": true,"entryPoint": [
"/entrypoint.sh"],"environment": [
{"name": "MYSQL_ROOT_PASSWORD","value": "pass"
}],"portMappings": []
}]
Essential to our Task
Create and mount volumes
Expose port 80 in containerto port 80 on host
10 CPU Units (1024 is full CPU),500 Megabytes of Memory
{"name": "busybox","image": "busybox","cpu": 10,"memory": 500,"volumesFrom": [{"sourceContainer": "simple-demo"
}],"entryPoint": [
"sh","-c"
],"command": [
"/bin/sh -c \"while true; do /bin/date > /var/www/my-vol/date; sleep 1; done\""
],"essential": false
}
Task Definitions[
{"image": "tutum/wordpress-stackable","name": "wordpress","cpu": 10,"memory": 500,"essential": true,"links": ["db"
],"entryPoint": ["/bin/sh","-c"
],"environment": […
],"portMappings": [{"containerPort": 80,"hostPort": 80
}]
},]
From Docker Hub
Mount volume from other container
Command to exec
Tasks
Good for short-lived containers, e.g.
batch jobs
Services
Good for long-running applications
and services
Service Scheduler
• Manage long-running applications and services• Build-in• What it does
• Load balacing• Health management• Scale-up and scale-down• Update management
• Drain ELB
DIY
Architectural Design
You want more ???
Container-level autoscaling
Amazon Lambda & Amazon ECS: Excellent !!!https://aws.amazon.com/blogs/compute/scaling-amazon-ecs-services-automatically-using-amazon-cloudwatch-and-aws-lambda/
Service discovery
Load Balancers
DNS
Service discovery services
Service discovery
Load Balancers
ECS Service scheduler
Service discovery
DNS
http://weave.works/guides/service-discovery-with-weave-aws-ecs.html
Service discovery
Service discovery services
https://aws.amazon.com/blogs/compute/service-discovery-via-consul-with-amazon-ecs
Monitoring & logging
Docker logs
Container logs
Extensible
Comprehensive APIs
Open source agent
Custom schedulers
Questions