![](/img/trans.png)
[英]How does this Dockerfile actually run logstash without an entrypoint or cmd?
[英]how to run a process on startup without CMD or ENTRYPOINT in a dockerfile?
這是一些示例 dockerfile:
FROM ubuntu:18.04
RUN apt-get install xvfb
CMD Xvfb :0 -ac # <-- I need this to run on start up, no as CMD
CMD node programThatNeedsXvfbRunning.js
默認情況下,我需要Xvfb :0 -ac
在圖像內運行,以便我可以執行docker run my-container someCustomCmdThatRequiresXvfbrunning
我知道我可以做Xvfb :0 -ac & node myapp
但每次都必須這樣做似乎很愚蠢。
試試這個Dockerfile
:
FROM ubuntu:18.04
RUN apt-get install xvfb
ENTRYPOINT [ "Xvfb", ":0", "-ac" ]
然后運行它:
docker run <image> cmd1 cmd2
這應該表現得好像你跑了:
Xvfb :0 -ac cmd1 cmd2
這是你想要的嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.