Docker Compose


  • configure relationships between containers
  • Save our docker container run settings in easy-to-read file
  • Create one-liner developer environment startups
  • YAML-formatted file that describes our solution options for:
  • containers
  • networks
  • volumes
  • A CLI tool docker-compose used for local dev/test automation with those YAML filesdocker-compose.yaml example
  • version: '2'
    #same as 
    #docker run -p 80:4000 -v $(pwd):/site bretfisher/jekyll-serve
    
    services:
      jekyll:
        image: bretfisher/jekyll-serve
        volumes:
          - .:/site
        ports:
          - '80:4000'
    . current working directory
    For more exmaples: https://docs.docker.com/
    docker-compose CLI
  • CLI tool comes with Docker for Windows/Mac, but separate. download for Linux
  • Not a production-grade tool but idead for local development and test
  • docker-compose + up setup volumes/networks and start all containersdown stop all containeres and remove containers/volumes/networks:ro used in volumes. read-only. (cannot change within container)
    if all your projects had a Dockerfile and docker-compose.yml then new developer onboarding would be:
  • git clone github.com/some/software
  • docker-compose-upBoom! Done!