← Blizzard Entertainment Interview Insights
I knew the individual commands but had a moment of second-guessing the order.
Start by explaining the order of operations: stop and remove containers first, then remove images, then volumes, because containers can hold references to images and volumes. Use Docker CLI commands with appropriate flags to force removal and avoid prompts. Finally, verify that all resources are cleaned up by running the three listing commands.
Pro tip: Mention that you would use `docker system prune -a --volumes` as a one-liner, but also explain the step-by-step commands to demonstrate deeper understanding and control, especially in production-like environments where you might want to be more careful.
Use `docker stop $(docker ps -aq)` to stop all running containers, then `docker rm $(docker ps -aq)` to remove all containers (including stopped ones). Alternatively, use `docker rm -f $(docker ps -aq)` to force stop and remove in one command.
Run `docker rmi $(docker images -aq)` to remove all images. If images are in use by stopped containers, ensure containers are removed first. Use `-f` flag if necessary to force removal.
Execute `docker volume rm $(docker volume ls -q)` to remove all volumes. Note that volumes in use by containers cannot be removed, so containers must be removed first.
Run `docker ps -a`, `docker images -a`, and `docker volume ls` to confirm that all three return empty lists. If not, investigate any remaining resources and remove them.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.