cheatsheets/docker/docker-compose.md

40 lines
620 B
Markdown

# Docker Compose Cheatsheet
### Template
```
# docker-compose.yml
version: '3' # Deprecated. Added for backwards-compatibility
services:
example01:
image: [image]:[tag]
container_name: example-container-01
ports:
- 80:80
environment:
- SECRET_PASSWORD="a secret!"
```
### Run compose file in detached mode
```
docker compose up -d
```
### Run compose file
```
docker compose up
```
### Stop specific compose service
```
docker compose stop [service name]
```
### Start specific compose service
```
docker compose start [service name]
```