Challenge - 5 Problems
Docker Service Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Output of docker-compose service start command
What is the output when you run
docker-compose up -d with this docker-compose.yml file?Docker
version: '3.8' services: web: image: nginx:latest ports: - "8080:80"
Attempts:
2 left
💡 Hint
Focus on what docker-compose creates by default when starting a service without volumes.
✗ Incorrect
The command creates a default network and starts the container for the 'web' service. No volumes are defined, so no volume creation message appears.
❓ Configuration
intermediate2:00remaining
Correct service definition for environment variables
Which service definition correctly sets environment variables for a service in
docker-compose.yml?Attempts:
2 left
💡 Hint
Check the correct key name and format for environment variables in docker-compose.
✗ Incorrect
The correct key is 'environment' with key-value pairs or list format. Option C uses key-value pairs correctly.
❓ Troubleshoot
advanced2:00remaining
Troubleshooting service port binding error
You defined this service in
docker-compose.yml but get an error when starting it: Bind for 0.0.0.0:80 failed: port is already allocated. What is the cause?Docker
services:
web:
image: nginx
ports:
- "80:80"Attempts:
2 left
💡 Hint
Check if any other application is using the host port before Docker tries to bind it.
✗ Incorrect
Port binding errors occur when the host port is already in use by another process, preventing Docker from binding it.
🔀 Workflow
advanced2:00remaining
Order of steps to update a running service with new image
What is the correct order of commands to update a running service to use a new image version in Docker Compose?
Attempts:
2 left
💡 Hint
You want to stop the old containers before pulling and starting new ones.
✗ Incorrect
First stop containers (down), then pull new images, then start containers (up -d), then check status (ps).
✅ Best Practice
expert2:00remaining
Best practice for defining multiple services sharing a network
Which docker-compose service definition best ensures two services share the same user-defined network named 'appnet'?
Attempts:
2 left
💡 Hint
Define the network under 'networks' and attach it explicitly to each service.
✗ Incorrect
Option B defines the network with a driver and attaches it to both services explicitly, ensuring they share the same network.