What is it?
● Tool
○ Define and Run
○ Multi-container docker apps
● Works in all environments
○ Development
○ Testing
○ Staging
○ Production
○ CI workflows
Prabhas Gupte
Common Use Cases
● Development environments
○ Document and configure your app’s service dependencies (db, cache, api, etc.)
● Automated testing environments
○ Convenient way to create and destroy isolated test environments
● Single host deployments
○ Single instance provisioned with Docker machine can host all your required services
Prabhas Gupte
What makes it effective?
● Multiple isolated environments on single host
● Recreate only changed containers
● Preserve volume data when containers are created
Prabhas Gupte
Demo
● docker-compose.yml
● docker-compose up
● docker-compose ps
● docker-compose stop
● docker-compose down
Prabhas Gupte
Further reading
● Compose file reference: https://docs.docker.com/compose/compose-file/
● Command line reference: https://docs.docker.com/compose/reference/
● Getting started: https://docs.docker.com/compose/gettingstarted/
● Examples:
○ Wordpress with MySQL: https://docs.docker.com/compose/wordpress/
○ Drupal with Postgres: https://docs.docker.com/samples/library/drupal/
○ Django with Postgres: https://docs.docker.com/compose/django/
○ Rails with Postgres: https://docs.docker.com/compose/rails/
● FAQs: https://docs.docker.com/compose/faq/
Prabhas Gupte
Questions?
Prabhas Gupte

Introduction to Docker Compose

  • 2.
    What is it? ●Tool ○ Define and Run ○ Multi-container docker apps ● Works in all environments ○ Development ○ Testing ○ Staging ○ Production ○ CI workflows Prabhas Gupte
  • 3.
    Common Use Cases ●Development environments ○ Document and configure your app’s service dependencies (db, cache, api, etc.) ● Automated testing environments ○ Convenient way to create and destroy isolated test environments ● Single host deployments ○ Single instance provisioned with Docker machine can host all your required services Prabhas Gupte
  • 4.
    What makes iteffective? ● Multiple isolated environments on single host ● Recreate only changed containers ● Preserve volume data when containers are created Prabhas Gupte
  • 5.
    Demo ● docker-compose.yml ● docker-composeup ● docker-compose ps ● docker-compose stop ● docker-compose down Prabhas Gupte
  • 6.
    Further reading ● Composefile reference: https://docs.docker.com/compose/compose-file/ ● Command line reference: https://docs.docker.com/compose/reference/ ● Getting started: https://docs.docker.com/compose/gettingstarted/ ● Examples: ○ Wordpress with MySQL: https://docs.docker.com/compose/wordpress/ ○ Drupal with Postgres: https://docs.docker.com/samples/library/drupal/ ○ Django with Postgres: https://docs.docker.com/compose/django/ ○ Rails with Postgres: https://docs.docker.com/compose/rails/ ● FAQs: https://docs.docker.com/compose/faq/ Prabhas Gupte
  • 7.

Editor's Notes

  • #3 Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.
  • #5 Compose uses a project name to isolate environments from each other. You can make use of this project name in several different contexts. on a dev host, to create multiple copies of a single environment on a CI server, to keep builds from interfering with each other on a shared host or dev host, to prevent different projects, which may use the same service names, from interfering with each other