cheatsheets/docker/docker-compose.md

41 lines
620 B
Markdown
Raw Normal View History

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