你如何附加和分离 Docker 的进程? [英] How do you attach and detach from Docker's process?

查看:27
本文介绍了你如何附加和分离 Docker 的进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以附加到一个 docker 进程,但 Ctrl+c 无法与它分离.exit 基本上停止了这个过程.

I can attach to a docker process but Ctrl+c doesn't work to detach from it. exit basically halts the process.

推荐的工作流程是什么,让流程运行,偶尔附加到它以进行一些更改,然后分离?

What's the recommended workflow to have the process running, occasionally attaching to it to make some changes, and then detaching?

推荐答案

要在不退出 shell 的情况下分离 tty,请使用转义序列 Ctrl+P 后跟 Ctrl+Q.更多详情此处.

To detach the tty without exiting the shell, use the escape sequence Ctrl+P followed by Ctrl+Q. More details here.

来自此来源的其他信息:

  • docker run -t -i → 可以用 ^P^Q 分离并用 docker attach 重新附加
  • docker run -i → 不能与^P^Q分离;会破坏标准输入
  • docker run → 不能与^P^Q分离;可以 SIGKILL 客户端;可以使用 docker attach 重新连接
  • docker run -t -i → can be detached with ^P^Qand reattached with docker attach
  • docker run -i → cannot be detached with ^P^Q; will disrupt stdin
  • docker run → cannot be detached with ^P^Q; can SIGKILL client; can reattach with docker attach

这篇关于你如何附加和分离 Docker 的进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆