Run command in stopped container

To restart a container

docker start -ia containerid-or-name

example:
docker run --name mybusybox busybox echo “hello world”
docker start -a mybusybox

I can’t understand why docker won’t bring convenience for user debugging. Anyway at least we can always backup, modify the xml file, docker start and revert everything.

When I do this, it’s to inspect files.
I do:

docker commit mycontainer myimage

Now that my container is an image, I can either directly start a shell in it or I have to override the entrypoint.
Pick your poison:

docker run -it myimage bash

or

docker run -it --entrypoint /bin/sh myimage

Using “ctr + p + q” allows you to exit a container without burning it to the ground. You can exec back into it because it’s still running.

docker container start mycontainer
docker container attach mycontainer