How to continue a Docker container which has exited

前端 未结 10 1953
爱一瞬间的悲伤
爱一瞬间的悲伤 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 14:59

    You can restart an existing container after it exited and your changes are still there.

    docker start  `docker ps -q -l` # restart it in the background
    docker attach `docker ps -q -l` # reattach the terminal & stdin
    

提交回复
热议问题