# compose up / down — Docker

Source: https://www.geekswithgeeks.com/en/docker/docker-compose-up-down

> Start and stop the whole stack with two commands.

## up and down

`up -d` builds (if needed) and starts every service in the background. `down` stops and removes the containers and network — add `-v` to also remove volumes.

```bash
docker compose up -d
docker compose logs -f app
docker compose down
docker compose down -v   # also remove named volumes
```

**Quiz:** What does `docker compose down -v` do differently from a plain `docker compose down`?

- [x] It also removes named volumes
- [ ] It runs in verbose mode
- [ ] It only stops, doesn't remove containers

*Answer:* It also removes named volumes. The -v flag additionally deletes named volumes declared in the compose file, wiping persisted data.
