简体   繁体   English

在Docker容器中运行Disco

[英]Running Disco in a Docker container

I need to run a run a Python script in a Docker container (I currently have execution of "disco_test.py" as my ENTRYPOINT command) that will utilize Disco (which of course needs to be running in that container). 我需要在Docker容器中运行一个Python脚本(我目前以ENTRYPOINT命令执行“ disco_test.py”),该ENTRYPOINT将利用Disco(当然需要在该容器中运行)。 The problem is I cannot seem to get Disco running either with CMD or RUN in the Dockerfile, or from within the Python script itself (using the subprocess module). 问题是我似乎无法使Disco在Dockerfile中以CMDRUN ,也无法从Python脚本本身(使用子流程模块)运行。

If, however, I create an otherwise identical image with no ENTRYPOINT command, run it with docker run -i -t disco_test /bin/bash and then open a Python shell, I can successfully get Disco running using the subprocess module (simply using call(["disco", "start"]) works). 但是,如果我创建了没有ENTRYPOINT命令的其他映像,则使用docker run -i -t disco_test /bin/bash运行它,然后打开Python shell,则可以使用子进程模块成功地使Disco运行(只需使用call(["disco", "start"])起作用)。 Upon exiting the Python shell I can indeed verify that Disco is still running properly ( disco status reports "Master 0cfddb8fb0e4:8989 running"). 退出Python Shell之后,我确实可以验证Disco仍在正常运行( disco status报告“ Master 0cfddb8fb0e4:8989正在运行”)。 When I attempt to start Disco in the same way (using call(["disco", "start"]) ) from within "disco_test.py", which I execute as the ENTRYPOINT command, it doesn't work! 当我尝试从“ disco_test.py”(以ENTRYPOINT命令执行)的相同方式(使用call(["disco", "start"]) )启动Disco时,它不起作用! It will print "Master 0cfddb8fb0e4:8989 started", however checking disco status afterwards ALWAYS shows "Master 0cfddb8fb0e4:8989 stopped". 它将打印“ Master 0cfddb8fb0e4:8989启动”,但是之后检查disco status始终显示“ Master 0cfddb8fb0e4:8989已停止”。

Is there something about how the ENTRYPOINT command is run that is preventing me from being able to get Disco running from within the corresponding Python script? ENTRYPOINT命令的运行方式是否有某些问题,使我无法从相应的Python脚本中运行Disco? Running "disco_test.py" on my machine (not in a Docker container) does indeed get Disco up and running successfully. 实际上,在我的机器上(不在Docker容器中)运行“ disco_test.py”确实可以使Disco启动并成功运行。

Any insights or suggestions would be greatly appreciated! 任何见解或建议,将不胜感激!

I would guess that its running daemonized and exits immediately stopping the container. 我猜想它的运行是守护进程,退出后立即停止容器。 You could try these containers dockerized disco . 您可以尝试将这些容器使用dockerized迪斯科 It uses supervisor to run disco. 它使用主管来运行迪斯科舞厅。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM