Challenge - 5 Problems
Memory Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Understanding Docker Memory Limit Output
What is the output of the following Docker command when inspecting a container's memory limits?
Docker
docker inspect --format='{{.HostConfig.Memory}}' my_container
Attempts:
2 left
💡 Hint
If no memory limit is set, Docker returns 0 for the Memory field.
✗ Incorrect
The .HostConfig.Memory field shows the memory limit in bytes. If no limit is set, it returns 0.
🧠 Conceptual
intermediate2:00remaining
Difference Between Memory Limit and Memory Reservation
Which statement correctly describes the difference between Docker's memory limit and memory reservation?
Attempts:
2 left
💡 Hint
Think about which setting restricts usage strictly and which one reserves resources.
✗ Incorrect
Memory limit sets the maximum memory a container can use (hard cap). Memory reservation reserves memory for the container but allows it to use more if available (soft guarantee).
❓ Configuration
advanced2:30remaining
Correct Docker Compose Memory Settings
Which Docker Compose service configuration correctly sets a memory limit of 512MB and a memory reservation of 256MB?
Docker
services:
app:
image: myapp
deploy:
resources:
limits:
memory: 512M
reservations:
memory: 256MAttempts:
2 left
💡 Hint
Memory values in Docker Compose use uppercase 'M' for megabytes without 'B'.
✗ Incorrect
Docker Compose expects memory values with units like '512M' or '256M'. Adding 'B' or lowercase letters causes errors or misinterpretation.
❓ Troubleshoot
advanced2:30remaining
Diagnosing Memory Limit Enforcement Failure
A container is set with a memory limit of 256MB but uses more memory without being killed. What is the most likely cause?
Attempts:
2 left
💡 Hint
Check if swap settings affect memory limit enforcement.
✗ Incorrect
If --memory-swap is unlimited, the container can use swap beyond the memory limit, so it may not be killed when exceeding the limit.
🔀 Workflow
expert3:00remaining
Order of Steps to Set Memory Limits on a Running Container
What is the correct order of steps to apply a memory limit of 1GB to an already running Docker container named 'webapp'?
Attempts:
2 left
💡 Hint
You cannot change memory limits on a running container without restarting it.
✗ Incorrect
You must stop the container first, then restart it with the new memory limit flag. Afterwards, verify the setting and update configuration files if needed.