Ctrl+Z(SIGTSTP)在docker容器中的bashshell中有奇怪的行为



我在Windows上使用Docker for Desktop。我在Powershell中用bash shell启动一个容器,如下所示:docker run-it ubuntu/bin/bash在bash shell中,我可以按预期使用Ctrl+C发送INT信号,但Ctrl+Z/SIGTSTP有意外的行为。有一段时间,它总是退出bash进程,并将我返回到Powershell,即使我在像vim这样的子进程中也是如此。其他时候,它会冻结bash,不再接受任何输入。我试过使用bash陷阱来查看信号是否被捕获,但事实似乎并非如此。这里可能发生了什么?我不知道问题出在bash、容器还是Powershell上。

此问题仍未解决。

我使用ConEmu和一些设置而不是powershell来避免这种奇怪的行为。(从各个方面来看,ConEmu比powershell或传统模式更强大。(

设置如下:

hotkey : macro
ctrl+z : MsgBox("ctrl+z is disabled. To avoid strange behavior of docker on powershell.","trapped ctrl+z")

这将截取ctrl+z并显示消息框。

参考。

  1. https://conemu.github.io/en/SettingsHotkeys.html
  2. https://conemu.github.io/en/GuiMacro.html#MsgBox

最新更新