You are on page 1of 1

DOCKER COMPOSE CHEAT SHEET

File Properties Other


structure build environment networks idle container
services: build image from dockerfile define env variables for the define all networks for the send container to idle state
container1: in specified directory container container > container will not stop
properties: values container: environment: networks: command: tail -f /dev/null
build: ./path KEY: VALUE - network-name
container2: image: image-name --- named volumes
properties: values environment: ports create volumes that can be used in
image - KEY=VALUE define ports to expose to other the volumes property
networks: use specified image containers and host services:
network: image: image-name
env_file ports: container:
define a env file for the - "9999:9999" image: image-name
volumes: container_name container to set and override volumes:
volume: define container name to access env variables expose - data-
it later env_file: .env define ports to expose only to volume:/path/to/dir
other containers
Types container_name: name ---
env_file: expose: volumes:
value volumes - .env - "9999" data-volume:
key: value define container volumes to
persist data restart network_mode networks
array volumes: define restart rule define network driver create networks that can be used
- /path:/path (no, always, on-failure, unless- (bridge, host, none, etc.) in the networks property
key:
stopped) network_mode: host
- value networks:
- value
command expose: frontend:
override start command for the - "9999" depends_on driver: bridge
dictionary container define build, start and stop
master: command: execute order of container
key: value depends_on:
key: value - container-name

You might also like