Docker Compose CLI
for ECS
14 April 2021 - AWS User Group Greece
Slide 2
Slide 2 text
Who am I?
Slide 3
Slide 3 text
Paris Kasidiaris /
/ @pariskasid
Founder at LOGIC — https://withlogic.co/
Co-founder at SourceLair — https://www.sourcelair.com
Co-host of Mikri Kouventa Podcast — http://mikrikouventa.fm
Co-organizer of Docker Athens User Group — http://docker.gr
Slide 4
Slide 4 text
Intro to Docker Compose CLI
Slide 5
Slide 5 text
Docker Compose CLI
● A new uniform CLI to manage applications
● Describe your application stack in a simple industry standard file
● Develop, build and publish whole application stacks
Slide 6
Slide 6 text
docker compose vs docker-compose
● Subcommand of docker
● Written in Go
● Multiple backends (local, ECS, ACI, Kube)
● Completely separate CLI tool
● Written in Python
● Local backend only
Slide 7
Slide 7 text
Why Docker Compose CLI
● Straightforward cloud native application development
● Use industry standard Compose specification
● Use the same commands local development on cloud providers (AWS) as well
Slide 8
Slide 8 text
Develop a web application with
Docker Compose CLI
Slide 9
Slide 9 text
Prerequisites
● Latest Docker Desktop on macOS or Windows
● Latest Compose CLI on Linux
● Your editor of choice
Slide 10
Slide 10 text
Develop a web application with Docker Compose CLI
1. Create a Dockerfile for our app
2. Create docker-compose.yml baseline
3. Create docker-compose.override.yml for development
4. Write some code
Slide 11
Slide 11 text
Web application specs
● Python 3.8
● Flask
● Return hostname of process
● Public Docker image on Docker Hub
Slide 12
Slide 12 text
Let’s get our hands dirty.
Slide 13
Slide 13 text
Docker Compose CLI for ECS
Slide 14
Slide 14 text
Docker Compose CLI for ECS
● Deploy to ECS using the same Docker Compose configuration
● Built in load balancing
● Built in scaling and auto scaling
● Built in secret management
● Built in service discovery
Slide 15
Slide 15 text
Deploy on ECS via
Docker Compose CLI
Slide 16
Slide 16 text
Prerequisites
● An active AWS account
● AWS credentials configured locally
● Latest Docker Desktop installed on macOS or Windows
● Latest Compose CLI installed on Linux
Slide 17
Slide 17 text
Under the hood
Compose CLI is a sophisticated client that transforms a Compose Spec file into AWS resources.
Eventually everything gets deployed as a CloudFormation stack. There is no black box.
If you have to, you can also access and modify the CloudFormation stack before deploying.
Slide 18
Slide 18 text
1. Create an ECS context in Docker client
2. Create a docker-compose.ecs.yml for ECS sprinkles
3. Run docker compose up
Really… that’s it.
Deploy on ECS via Docker Compose CLI
Slide 19
Slide 19 text
● Use deploy.resources.limits in Compose file to scale container size
● Use deploy.replicas in Compose file to scale container replicas
Scale on ECS via Docker Compose CLI
Slide 20
Slide 20 text
● Docker Compose CLI supports CPU-based container replica auto scaling on ECS
● Uses the x-aws-autoscaling vendor attribute in Compose File
Auto scale on ECS via Docker Compose CLI
Slide 21
Slide 21 text
Known issues
Slide 22
Slide 22 text
Known issues
● #1214 — Compose CLI likes us-east-1 a bit too much
● #670 — No docker compose exec yet
Slide 23
Slide 23 text
That’s all folks!
Slide 24
Slide 24 text
● https://docs.docker.com/cloud/ecs-integration/
● https://github.com/docker/compose-cli
● https://github.com/compose-spec/compose-spec
● https://docs.docker.com/compose/compose-file/compose-file-v3/
A few useful links
Slide 25
Slide 25 text
Questions?
Slide 26
Slide 26 text
We can help with DevOps!
Do you plan to double down on Docker, Infrastructure and all the sweet DevOps?
Do you want to build your next project on lean and automated processes?
We are here to help: [email protected]
Slide 27
Slide 27 text
Thanks!
Find the code at https://github.com/parisk/aws-user-group-greece-compose-cli
Follow me at https://twitter.com/pariskasid