如何停止容器内?

我正在尝试让容器自行终止(例如,当它检测到exception时)。 但关机似乎不起作用。 这是我在容器中运行的内容。

$ sudo shutdown -h now shutdown: Unable to shutdown system Broadcast message from ... The system is going down for halt NOW! 

当点击“Enter”时,它会回来。

有可能吗?

一旦入口点退出,容器将停止。 如果你进入交互模式,只需按Ctrl + D。