"Docker Hints - Poke a Stopped Container"

I am in a situation at the moment where I am trying to install a custom Python package into my little app, but for reasons yet to be determined, it's installing into the wrong directory.

Everything we do is Dockerised, which is great til a container crashes and you really need to go and have a poke about in it. Today, I have found a handy solution!

  1. List all stopped Docker containers using

    docker ps -aq -f status=exited 1. Grab the container id and use it to create a new image like this:

    docker commit $CONTAINER_ID $NEW_IMAGE_NAME 1. Log into that new image like this:

    docker run -ti --entrypoint=bash $NEW_IMAGE_NAME

Tada! Now I can see where the hell my package has gone. I still don't know what's going on there but at least I can see things now :D