Recall & Review
beginner
What is a Compose profile in Docker Compose?
A Compose profile is a way to group services in a Docker Compose file so you can selectively start those services by enabling specific profiles (services without profiles always start too).
Click to reveal answer
beginner
How do you define a profile for a service in a Docker Compose file?
You add a 'profiles' key under the service with a list of profile names. For example:<br>
services:
web:
image: nginx
profiles:
- frontendClick to reveal answer
beginner
How do you start Docker Compose with a specific profile?
Use the command:
docker compose --profile <profile_name> up to start services in that profile (in addition to services without profiles).Click to reveal answer
intermediate
What happens if you run 'docker compose up' without specifying any profile?
Docker Compose starts all services that have no profile specified. Services assigned to profiles are not started unless their profile is enabled.
Click to reveal answer
beginner
Why use Compose profiles for selective services?
Profiles help you manage complex projects by starting only the services you need for a specific task, like development, testing, or production, saving resources and time.
Click to reveal answer
How do you specify a profile for a service in a Docker Compose file?
✗ Incorrect
The correct way is to add a 'profiles' key with a list of profile names under the service.
What command starts services in the 'frontend' profile only?
✗ Incorrect
Use 'docker compose --profile frontend up' to start services in the 'frontend' profile (in addition to services without profiles).
If a service has no profile defined, when does it start?
✗ Incorrect
Services without profiles always start when you run 'docker compose up', regardless of profiles specified.
Why might you use profiles in Docker Compose?
✗ Incorrect
Profiles group services so you can start only the ones you want.
What happens if you run 'docker compose up' with no profiles specified?
✗ Incorrect
Only services without profiles start by default when no profile is specified.
Explain how to use Compose profiles to start only selected services in a Docker Compose project.
Think about grouping services and using command line to select them.
You got /4 concepts.
Describe the benefits of using Compose profiles in managing Docker services.
Consider how profiles help organize and control service execution.
You got /4 concepts.