Docker Compose Flashcards
1
Q
Docker Compose Basics
A
- Markdown tool to specify Docker configurations as code
- Procedural
- Declarative
2
Q
Production System Considerations
A
- Multiple Systems
- Microservices
- Third-party dependencies
3
Q
Procedural
A
- Series of ordered steps
- Based on assumptions about the previous step
- Easy to introduce errors
4
Q
Declarative
A
- Specify end results
- System will determine which steps to execute
- Produces the same result each time
5
Q
Main Benefits of Docker Compose
A
- Version control
- Self-documenting
- Easy management
6
Q
Designed For
A
- Local development
- Staging server
- Continuous integration testing environment
7
Q
Not Designed For
A
- Distributed systems
- Complex production environments
- No autoscaling
- Use orchestration tools like Docker Swarm or Kubernetes in production
8
Q
Docker Compose Configuration
A
- Create a file “docker-compose.yaml”
- Version: specifies which version of Docker Compose to use
- Services: specifies which containers are required (specify a path to the corresponding Docker build file or image)
9
Q
Start all services defined in the Docker Compose file
A
- “docker-compose up”
- Pass in a service name to any command to only apply it to that service
10
Q
Stop all containers
A
- “docker-compose down”
- Deletes all containers and images and removes all artifacts
11
Q
Save battery or free memory
A
- “docker-compose stop”
12
Q
Stop and restart all containers
A
- “docker-compose restart”
13
Q
Environment Variables
A
- Accessible inside a running Docker container
- Specify runtime environment
- Use env files if necessary (pass in env file path)
- Including an env variable name without a value will pass in the value from the host server
14
Q
Build Arguments
A
- Accessible only at build times
- Build tool versions
- Cloud platform configuration
15
Q
Target Volume
A
- File directory path inside a container where the volume data lives