Akashic Records

Docker Compose 설치 본문

Library

Docker Compose 설치

Andrew's Akashic Records 2021. 1. 7. 10:30
728x90

 

docs.docker.com/compose/install/

자세한 내용은 여기

 

Install Docker Compose

 

docs.docker.com

1. sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

 

2. sudo chmod +x /usr/local/bin/docker-compose

 

3. $ docker-compose --version

   docker-compose version 1.27.4, build 1110ad01

 

4. "docker-compose" 명령이 실행이 안되면 

sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

 

Overview of Docker Compose

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. To learn more about all the features of Compose, see the list of features.

Compose works in all environments: production, staging, development, testing, as well as CI workflows. You can learn more about each case in Common Use Cases.

Using Compose is basically a three-step process:

  1. Define your app’s environment with a Dockerfile so it can be reproduced anywhere.

  2. Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment.

  3. Run docker-compose up and Compose starts and runs your entire app.

A docker-compose.yml looks like this:

version: "3.9"  # optional since v1.27.0
services:
  web:
    build: .
    ports:
      - "5000:5000"
    volumes:
      - .:/code
      - logvolume01:/var/log
    links:
      - redis
  redis:
    image: redis
volumes:
  logvolume01: {}

 

For more information about the Compose file, see the Compose file reference.

Compose has commands for managing the whole lifecycle of your application:

  • Start, stop, and rebuild services
  • View the status of running services
  • Stream the log output of running services
  • Run a one-off command on a service
728x90
Comments