官方文档:
https://docs.docker.com/engine/reference/commandline/attach/
用法实例:
创建一个后台运行可以互动的容器
#docker run -itd --name test-attach-1 centos
查看正在运行的容器
#docker ps
attach命令进入容器
#docker attach test-attach-1
![](https://img.haomeiwen.com/i3100692/d1c5416d00b76c68.png)
我们常用户退出终端命令,exit
docker ps 发现容器退出了。
![](https://img.haomeiwen.com/i3100692/7320d3f6f48a516d.png)
官方文档描述
![](https://img.haomeiwen.com/i3100692/73f716ba90fc8bb0.png)
如果使用<code>CTRL+C</code>会发送一个SINKILL信号,所以如果我们不想我们的容器退出,我们可以是用
CTRL-p CTRL-q
网友评论