Create Docker Container from Errored Container

When I’m trying to “dockerize” an applciation I usually have to work through some wonkiness.

To diagnose a container that has errored out, I, obviously, look at the logs via docker logs -f [container_name]. That is sometimes helpful. It will, at minimum tell me where I need to focus on the new container I’m going to create.


Pre-requisites to being able to build a diagnosis container:

  • You need to use CMD, not ENTRYPOINT in the Dockerfile
    • with CMD you’ll be able to start a shell, with ENTRYPOINT your diagnosis container will just keep trying to run that

To create a diagnosis container, do the following:

  • Check your failed container ID by docker ps -a
  • Create docker image form the container with docker commit
    • example: docker commit -m "diagnosis" [failed container id]
  • Check the newly create docker image ID by docker images
  • docker run -it [new container image id] sh
    • this takes you into a container immediately after the error occurred.

Hope this helps someone else.


Jason Meridth


My name is Jason Meridth. I am a continuously learning senior software developer/devops/team lead/development manager trying to not let best be the enemy of better. I reserve the right to change my mind upon obtaining more information. I am also the owner and principal software consultant at Meridth, LLC. If you have any software, hardward, networking, process, etc needs please don't hesitate to reach out to me.

Raspberry Pi Kubernetes Cluster - Part 2

Howdy again.Alright, my 8 port switch showed up so I was able to connect my raspberry 3B+ boards to my home network. I plugged it in wit...… Continue reading

Raspberry Pi Kubernetes Cluster - Part 1

Published on April 07, 2018

SSH - Too Many Authentication Failures

Published on March 28, 2018