Docker Compose

skang6283·2021년 1월 26일
0

Docker

목록 보기
6/6

  • configure relationships between containers
  • Save our docker container run settings in easy-to-read file
  • Create one-liner developer environment startups
  1. YAML-formatted file that describes our solution options for:
    • containers
    • networks
    • volumes
  2. A CLI tool docker-compose used for local dev/test automation with those YAML files
    docker-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 containers
down 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-up
    Boom! Done!
profile
Hi :) I'm Max

0개의 댓글