Consider:
docker run -it centos /bin/bash
I pressed Ctrl+D to exit it.
I want to continue to run this container, but I found I can't.
The only method is
docker commit `docker ps -q -l` my_image
docker run -it my_image /bin/bash
Am I right? Is there a better method? (I'm using docker 0.8.0.)
If you have a named container then it can be started by running
where container_name is name of the container that must be given at the time of creating container. You can replace
container_name
with the container id in case the container is not named. The container ID can be found by running:This will start up all the containers that are in the 'Exited' state
These commands will work for any container (not only last exited ones). This way will work even after your system has rebooted. To do so, these commands will use "container id".
Steps:
List all dockers by using this command and note the container id of the container you want to restart:
docker ps -a
Start your container using container id:
docker start <container_id>
Attache and run your container:
docker attach <container_id>
NOTE: I had tried this with linux system
Hope this helps someone!