Resolving Docker Container Removal Issues | Generated by AI

Home 2025.10

Nice — thanks, that output confirms the container is stuck in Removal In Progress and docker rm -f fails with the same overlay2 error. Below I’ll give a careful, ordered recovery plan specifically for macOS using Docker Desktop (your prompt shows Docker Desktop proxy messages). I’ll mark destructive steps clearly and give exact commands you can copy/paste. Follow them in order until the issue is resolved.


1) Quick non-destructive checks (one-liners)

Run these first — they’re safe and help collect info.

# Docker versions & info (helpful for debugging)
docker version
docker info

# Inspect the stuck container (may or may not return full info)
docker inspect ccd89a3f36a1528cb923c90de8755faeb36e229cab353c2285222948197b8d18 || true

# Try reading logs (may fail if container state is broken)
docker logs ccd89a3f36a1528cb923c90de8755faeb36e229cab353c2285222948197b8d18 || true

If docker inspect or docker logs produce useful output, paste it here and I’ll interpret it. (If they error with overlay messages you can still continue.)


2) Restart Docker Desktop (safe, often fixes it)

Quit Docker Desktop fully, then start it again.

osascript -e 'quit app "Docker"'
open -a Docker

After Docker restarts, try:

docker rm -f ccd89a3f36a1528cb923c90de8755faeb36e229c

If still failing, continue.


3) If restart didn’t help — kill low-level VM process then restart Docker (safe-ish)

Sometimes the embedded VM (hyperkit) is hung. Killing it forces a clean restart. This is normally safe but will stop all running containers.

# find the hyperkit process used by Docker Desktop
ps aux | grep -i hyperkit | grep -v grep

# kill it (replace PID with the number from previous command)
sudo kill -9 <PID>

# then start Docker again
open -a Docker

Try docker rm -f <id> again.


4) Non-destructive cleanup attempts

If the container still won’t remove, try pruning unused Docker objects. These are safe for unused items:

docker system prune -f
docker volume prune -f
docker container prune -f

Then retry the docker rm -f command.


5) Export what you need before a destructive reset (important)

If nothing fixes the stuck container, the next practical option on Docker Desktop is Reset / Clean / Purge via Docker Desktop UI — but that can delete images/volumes/containers. If you have images or volumes you want to keep, save them now.

Save images:

# list images you care about
docker images

# save an image (example)
docker save -o ~/myimage.tar my-image:tag

Export volumes (example — replace myvolume and ./backup as needed):

mkdir -p ~/docker-vol-backups
docker run --rm -v myvolume:/data -v ~/docker-vol-backups:/backup alpine \
  sh -c "cd /data && tar czf /backup/myvolume.tgz ."

If the stuck container is preventing normal docker run access to volumes, backups may not work; in that case proceed to the Reset option below.


Open Docker Desktop → click the Troubleshoot icon (or Preferences → Troubleshoot). Try these in order:

  1. Restart Docker (if you haven’t after killing hyperkit).
  2. Clean / Purge data — this removes images/containers/volumes. Destructive.
  3. Reset to factory defaultsdestructive, resets Docker Desktop state.

If you want me to help keep important images/volumes before you reset, tell me the output of docker images and docker volume ls (from step 1) and I’ll give exact save/export commands.


7) Force-remove Docker VM files (advanced / destructive) — only if you accept data loss

If you are comfortable losing local Docker data and the Desktop UI Reset didn’t work, you can delete Docker Desktop’s VM files. This is last resort.

Warning — this deletes all Docker Desktop containers, images, and volumes.

  1. Quit Docker Desktop.
  2. In Finder or terminal, delete Docker’s data folder:
# quit docker first
osascript -e 'quit app "Docker"'

# remove Docker Desktop VM data (destructive)
rm -rf ~/Library/Containers/com.docker.docker
rm -rf ~/.docker
  1. Start Docker Desktop again (it will recreate state). Then run docker system prune -a --volumes to clean up whatever remains.

8) Collecting diagnostics for deeper help

If you’d like me to dig further before destructive steps, generate Docker Desktop diagnostics and paste the diagnostic ID here:

You can also paste outputs of these commands (non-destructive):

docker info
docker ps -a
docker inspect ccd89a3f36a1528cb923c90de8755faeb36e229cab353c2285222948197b8d18 || true

  1. Quit & restart Docker Desktop. Try docker rm -f again.
  2. If still stuck: kill hyperkit (sudo kill -9 PID), restart Docker Desktop. Retry.
  3. Run docker system prune / volume prune. Retry.
  4. Export/save any images/volumes you need.
  5. Use Docker Desktop → Troubleshoot → Clean / Purge data (or Reset) if you can afford data loss.
  6. If you want me to help interpret logs before destructive steps, paste docker info and docker ps -a outputs or the diagnostic ID.

Tell me which step you just tried and paste the outputs of:

docker info
docker ps -a
docker images
docker volume ls

— I’ll analyze them and give the exact next command tailored to your state.


Back

openai/gpt-5

Donate