Docker-compose
Used to run multiple containers on same host
Outdated better to use docker stack/kubernetes now apparently
Commands
Cmd
Effect
docker-compose up
Run containers
docker-compose build
Build containers
docker-compose exec {service name} sh
Enter service shell
Setup
The Compose file is a YAML file defining services, networks and volumes. The default path for a Compose file is ./docker-compose.yml.
docker-compose.yml
version: "3"
services:
node_backend:
build: ./backend
ports:
- "3001:3001"
volumes:
- ./backend:/app
react_frontend:
build: ./client
ports:
- "3000:3000"
volumes:
- ./client:/appConfig Options
build
build can be specified either as a string containing a path to the build context
image
build: ./dir
image: webapp:tagThis results in an image named webapp and tagged tag, built from ./dir.
Last updated