version:
services:
<service_name>:
image:
links:
hostname:
environment:
restart:
volumes:
platform:
build:
context:
dockerfile:
entrypoint:
command:
logging:
driver:
options:
#fluentd-address:
#tag:
healthcheck:
test:
interval:
timeout:
retries:
start_period:
depends_on:
env_file:
ports:
tty:
networks:
secrets:
source:
target:
deploy:
mode:
replicas:
update_config:
parallelism:
order:
delay:
failure_action:
dns:
labels:
devices:
external_links:
extra_hosts:
<service_name2>:
...
networks:
<network_name>
external:
name: <network_name>
volumes:
version
Statement | Description | etc |
version | 해당 도커파일에 사용된 도커 컴포즈 파일 형식 버전 |
services
Statement | Description | etc |
services | 애플리케이션을 구성하는 모든 서비스 | |
image | 실행할 이미지 지정 | 컨테이너 이름이나 DNS 이름 |
links | 다른 컨테이너와의 연결 | |
hostname | Hostname 설정 | |
environment | 컨테이너에서 사용될 환경 변수 값 정의 | |
restart | 컨테이너 Restart 방식 설정 | ∙ no : 수동으로 재시작 ∙ always : 컨테이너를 수동으로 끄기 전까지 항상 재시작 ∙ on-failure : 오류가 있을 시 재시작 |
volumes | 지정한 경로 Volume 마운트 | |
platform | OS architecture | linux/arm64, linux/amd64, ... |
build context dockerfile |
해당 디렉터리에 있는 Dockerfile 빌드 ∙ context : Build context path ∙ dockerfile : 빌드할 도커파일 Path |
도커파일 이름이 Dockerfile이라면, build: . 아니라면, context dockerfile 사용 |
entrypoint | ENTRYPOINT | |
command | COMMAND | |
logging driver options |
logging 설정 | |
healthcheck test interval timeout retries start_period |
컨테이너 상태를 점검하기 위한 설정 ∙ test : Health check command ∙ interval : 헬스 체크 실시 간격 ∙ timeout : 실패로 간주하기까지의 제한 시간 ∙ retries : 상태 이상까지 필요한 연속 실패 횟수 ∙ start_period : 컨테이너 실행 후 첫 healthcheck 까지의 시간 |
|
depends_on | 해당 서비스가 다른 서비스에 의존함을 의미 (해당 서비스 실행 전 나열된 기술을 먼저 실행함) |
|
env_file | 컨테이너 환경변수 정의를 위한 .env 경로 | |
ports | Host:Container | = External port: Internal port |
tty | Keep the container running | |
networks | 서비스가 구성될 도커! 네트워크 | |
secrets source target |
실행 시 컨테이너 내부 파일에 기록될 secret ∙ source : value 정의 ∙ target : |
e.g. DB password, 인증서, API key, .. |
extends | Make this service extend another | |
dns | DNS 설정 | |
labels | ||
devices | ||
external_links | ||
extra_hosts | ||
deploy mode replicas update_config |
networks
Statement | Description | etc |
networks | Creates a custom network called network_name | |
external | 해당 네트워크는 이미 존재하므로 생성하지 않음 |
volumes
Statement | Description | etc |
volumes | volume 생성 및 사용 |
Reference
Overview
docs.docker.com
Compose file version 3 reference
docs.docker.com
Docker Compose Cheatsheet
Docker Compose Cheatsheet. GitHub Gist: instantly share code, notes, and snippets.
gist.github.com
Health Check Command in Docker
Assessing the health of a resource is one of the most vital aspects of a health check. Docker uses health checks to keep its containers healthy.
www.atatus.com
'인프라 > 도커' 카테고리의 다른 글
[Docker] 도커파일 정리 (0) | 2023.03.24 |
---|---|
[Docker] 도커 컴포즈 명령어 정리 (0) | 2023.03.24 |
[Docker] 도커 명령어 정리 (0) | 2023.03.23 |
[Docker] Shortcut (0) | 2023.03.23 |