0
0
Dockerdevops~20 mins

Container disk usage management in Docker - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Disk Usage Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Check disk space used by Docker images
What is the output of the command docker system df -v regarding image sizes?
Docker
docker system df -v
AShows Docker daemon logs related to disk usage
BOnly lists running containers with their disk usage
CDisplays network usage statistics for Docker containers
DShows detailed disk usage including images, containers, volumes, and build cache with sizes
Attempts:
2 left
💡 Hint
Think about which command gives a detailed summary of disk usage for all Docker objects.
Troubleshoot
intermediate
2:00remaining
Identify cause of disk space not freeing after container removal
You removed a Docker container but disk space did not increase. What is the most likely reason?
AThe container was not actually stopped before removal
BDocker daemon needs to be restarted to free space
CThe container's volumes are still present and consuming space
DDocker images are automatically deleted with container removal
Attempts:
2 left
💡 Hint
Think about what Docker volumes do when containers are deleted.
Configuration
advanced
3:00remaining
Configure Docker to limit container log size
Which Docker daemon configuration snippet correctly limits container log files to 10MB with 3 rotated files?
A
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m",
    "max-file": "1"
  }
}
B
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  }
}
C
{
  "log-driver": "syslog",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  }
}
D
{
  "log-driver": "journald",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  }
}
Attempts:
2 left
💡 Hint
The default log driver that supports size and file rotation is json-file.
🔀 Workflow
advanced
3:00remaining
Steps to safely clean up unused Docker resources
Which option lists the correct sequence of commands to safely clean up unused containers, images, volumes, and build cache?
Adocker container prune → docker image prune → docker volume prune → docker builder prune
Bdocker volume prune → docker container prune → docker builder prune → docker image prune
Cdocker system prune -a → docker container prune → docker volume prune → docker builder prune
Ddocker builder prune → docker image prune → docker container prune → docker volume prune
Attempts:
2 left
💡 Hint
Start by removing stopped containers, then images, volumes, and finally build cache.
Best Practice
expert
3:00remaining
Prevent excessive disk usage by containers in production
Which practice best prevents excessive disk usage by Docker containers in a production environment?
AUse read-only root filesystem for containers and mount writable volumes only where needed
BDisable Docker logging to prevent log files from growing
CRun containers with unlimited disk quota to avoid failures
DAvoid using volumes and store all data inside containers
Attempts:
2 left
💡 Hint
Think about controlling where data is written to limit disk growth.