41 lines
585 B
Markdown
41 lines
585 B
Markdown
|
# Docker Compose Cheatsheet
|
||
|
|
||
|
### Template
|
||
|
|
||
|
```
|
||
|
# docker-compose.yml
|
||
|
version: '3' # Deprecated.
|
||
|
services:
|
||
|
alpine:
|
||
|
image: alpine:latest
|
||
|
container_name: alpine-example
|
||
|
ports:
|
||
|
- 8001:8001
|
||
|
environment:
|
||
|
- SECRET_PASSWORD="a secret!"
|
||
|
```
|
||
|
|
||
|
### Run compose file in detached mode
|
||
|
|
||
|
```
|
||
|
docker compose up -d
|
||
|
```
|
||
|
|
||
|
### Spin up compose file
|
||
|
|
||
|
```
|
||
|
docker compose up
|
||
|
```
|
||
|
|
||
|
### Stop specific compose service
|
||
|
|
||
|
```
|
||
|
docker compose stop [service name]
|
||
|
```
|
||
|
|
||
|
### Start specific compose service
|
||
|
|
||
|
```
|
||
|
docker compose start [service name]
|
||
|
```
|