I've been experimenting with setting up a docker image and I noticed that it immediately shut down after running it. I wanted to ssh into the console to verify that files were copied.

What was the problem?

I was running it like this:

view plain print about
1docker run --name mdi my-docker-image:latest

That set it up and ran default scripts and immediately quit. Since this container was not starting any daemons there was no reason for the container to continue to run.

It turned out I needed to use the it switch

view plain print about
1docker run --name mdi -it my-docker-image:latest

This would prevent the container from immediately stopping.