Starting and Stopping
bash
1# Start all services
2docker compose up
3
4# Start in detached mode
5docker compose up -d
6
7# Start specific service
8docker compose up web
9
10# Stop services
11docker compose stop
12
13# Stop and remove containers
14docker compose down
15
16# Remove volumes too
17docker compose down -vBuilding
bash
1# Build images
2docker compose build
3
4# Build without cache
5docker compose build --no-cache
6
7# Build and start
8docker compose up --buildLogs and Status
bash
1# View logs
2docker compose logs
3
4# Follow logs
5docker compose logs -f
6
7# Specific service
8docker compose logs -f web
9
10# List containers
11docker compose ps
12
13# List all (including stopped)
14docker compose ps -aRunning Commands
bash
1# Run one-off command
2docker compose run web rails console
3
4# Execute in running container
5docker compose exec web bash
6
7# Run without starting dependencies
8docker compose run --no-deps web bashScaling
bash
1# Scale service
2docker compose up -d --scale web=3