Docker solved our “works on my machine” problem. But running five containers manually with twenty-line docker run commands? docker-compose (then still called Fig) brought an elegant solution — one YAML file, one command, the entire stack.
Our Development Stack¶
version: '2'
services:
app:
build: .
ports:
- "8080:8080"
depends_on:
- db
- redis
environment:
- DB_HOST=db
db:
image: postgres:9.4
environment:
- POSTGRES_DB=myapp
- POSTGRES_PASSWORD=dev
volumes:
- pgdata:/var/lib/postgresql/data
redis:
image: redis:2.8
rabbitmq:
image: rabbitmq:3-management
ports:
- "15672:15672"
volumes:
pgdata:
Advantages Over Vagrant¶
Service isolation, speed (seconds vs. minutes), less memory, closer to production. docker-compose creates an isolated network — services see each other by the names in the YAML.
Configuration and Tips¶
.env file for variables. docker-compose.override.yml for local customization (in .gitignore). Use depends_on, but implement retry logic in the application. Named volumes for persistent data.
docker-compose Is a Game Changer¶
One file defines the entire infrastructure. Versioned, reviewed, shared in Git. If you’re using Docker, docker-compose is the logical next step.
Need help with implementation?
Our experts can help with design, implementation, and operations. From architecture to production.
Contact us