如何继续退出的Docker容器 [英] How to continue a Docker container which has exited
本文介绍了如何继续退出的Docker容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
考虑:
docker run -it centos /bin/bash
我按 Ctrl + D 退出它。
I pressed Ctrl+D to exit it.
我想继续运行此容器,但我发现不能。
I want to continue to run this container, but I found I can't.
唯一的方法是
docker commit `docker ps -q -l` my_image
docker run -it my_image /bin/bash
对吗?有没有更好的方法? (我正在使用docker 0.8.0。)
Am I right? Is there a better method? (I'm using docker 0.8.0.)
推荐答案
您可以在现有容器退出后重新启动,并且所做的更改仍然存在
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
这篇关于如何继续退出的Docker容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文