Consider:
docker run -it centos /bin/bash
I pressed Ctrl+D to exit it.
I wa
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>
Attach and run your container:
docker attach <container_id>
NOTE: Works on linux
Follow these steps:
Run below command to see that all the container services both running and stopped on. Option -a
is given to see that the container stops as well
docker ps -a
Then start the docker container either by container_id
or container tag names
docker start <CONTAINER_ID> or <NAMES>
Say from the above picture, container id
4b161b302337
So command to be run is
docker start 4b161b302337
One can verify whether the container is running with
docker ps
docker start `docker ps -a | awk '{print $1}'`
This will start up all the containers that are in the 'Exited' state
If you want to continue exactly one Docker container with a known name:
docker start `docker ps -a -q --filter "name=elas"`