Skip to content

Instantly share code, notes, and snippets.

@kyle-morton
Last active August 18, 2020 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyle-morton/1b55595119a791165af5948e494cd126 to your computer and use it in GitHub Desktop.
Save kyle-morton/1b55595119a791165af5948e494cd126 to your computer and use it in GitHub Desktop.
Docker Compose

Docker Compose

Features

  • manages the whole app lifecycle -- start, stop, and rebuilding services -- view status of running services -- stream the log output of running services -- run a one-off command on a service

Docker Compose Workflow

  • build services (create images)
  • start up the services
  • tear down the services

docker-compose.yaml

  • defines our services (frameworks, db services, web app services)
  • run it thru a docker compose build to produce images
  • generates services (images) that you can then run

Example File

version: "3.x" services: node: build: context: . dockerfile: node.dockerfile networks: -nodeapp-network mongodb: image: mongo networks: -nodeapp-network networks: nodeapp-network driver:bridge

Docker Compose Commands

docker-compose build

  • build images from compose file

docker-compose up

docker-compose down

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment