如何重新启动容器内的进程/使用原始的restart.py重新启动PhpStorm

我正在用PhpStorm做一个图像(作为我构build可移植开发环境的一部分)。 除了PhpStorm无法自行重启,一切运行都很顺利。 它使用bin/restart.py脚本,在docker化时不起作用。

这是脚本的身体:

 #!/usr/bin/env python # Waits for the parent process to terminate, then executes specified commands. import os import signal import sys import time if len(sys.argv) < 3: raise Exception('usage: restart.py <pid> <path> [optional command]') signal.signal(signal.SIGHUP, signal.SIG_IGN) pid = int(sys.argv[1]) while os.getppid() == pid: time.sleep(0.5) // *** if len(sys.argv) > 3: to_launch = sys.argv[3:] os.spawnv(os.P_WAIT, to_launch[0], to_launch) to_launch = ['/usr/bin/open', sys.argv[2]] if sys.platform == 'darwin' else [sys.argv[2]] os.execv(to_launch[0], to_launch) 

脚本运行到标有***的行 – 即父进程退出后立即运行。

我试图用bash root进程运行PhpStorm,以及与dumb-init或TINI进程没有任何区别。

任何想法出了什么问题,以及如何“解决”这个? 是否有一些特定的信号必须在根进程中执行,或者是docker工人不允许这种用途的性质?

解决问题最简单的方法就是重新启动容器,这是将容器放入容器中的关键。