You're on a server that's been a Docker host for a while. As it often happens, containers came and went, leaving behind both anonymous and named volumes. Disk space is about to run out - time to clean things up!
Your goal:
- Remove (prune) all unused anonymous volumes.
- Identify the largest unused named volume and remove it.
- Keep all other named volumes in place for future runs.
Hint: List and inspect volumes 💡
You can use the docker volume ls
command to list all volumes in the system.
However, the output of this command is not very informative,
so you may need to dive in and inspect each volume individually using docker volume inspect
.
Can you tell what makes a volume anonymous?
Hint: Avoid "shotgun" removal 💡
Avoid running a broad script that removes all volumes indiscriminately. It would also delete unused named volumes, which is often not what you want on a real-world system.
Hint: Use the right tool for the job 💡
While scripted conditional removal using the docker volume rm
command is one of the options
(especially when an LLM can generate such a script for you in no time),
it might be a bit too error-prone.
Better use the right tool for the job.
Check this out:
docker volume prune --help
Hint: Remove only that one named volume 💡
This time, you need to remove a single volume,
so the use of the targeted docker volume rm
command is well justified.
But first, you'll need to identify that one volume you're asked to sacrifice...
Hint: Identify the largest named volume 💡
Neither docker volume ls
nor docker volume inspect
output volume sizes,
so you'll need to be creative.
All volumes in this challenge use the default local
driver,
meaning they are backed by regular directories on the host.

You'll need to inspect the volumes one by one,
identifying the corresponding directory (mountpoint).
Once you have the list of directories,
you can use standard Linux utilities (e.g., du
, ls
, etc.) to find the largest one.
Then, get back to the Docker CLI and run docker volume rm
providing the name of the largest volume.
Hint: Don't rush with removing the largest volume 💡
The largest volume may not always be the one you're asked to remove. Pay close attention to the wording of the challenge.
Level up your Server Side game — Join 13,000 engineers who receive insightful learning materials straight to their inbox