How to continue a Docker container which has exited

前端 未结 10 1948
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-29 14:51

Consider:

docker run -it centos /bin/bash

I pressed Ctrl+D to exit it.

I wa

10条回答
  •  清歌不尽
    2020-11-29 15:14

    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:

    1. List all dockers by using this command and note the container id of the container you want to restart: docker ps -a

    2. Start your container using container id: docker start

    3. Attach and run your container: docker attach

    NOTE: Works on linux

提交回复
热议问题