安装在Docker容器后,Jenkins不会自动运行 [英] Jenkins does not run automatically after install in Docker container

查看:577
本文介绍了安装在Docker容器后,Jenkins不会自动运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Jenkins安装在Docker容器中,并且不会自动运行。
我必须运行/etc/init.d/jenkins启动。那么一切顺利而好。
我所遵循的所有教程说,安装后应该默认运行,但是它不会。



任何想法?

解决方案

如果你喜欢在各种詹金斯图像的Dockerfile(像官方的 _ / jenkins 一个),你会看到为什么jenkins自动运行:

  COPY jenkins.sh /usr/local/bin/jenkins.sh 
ENTRYPOINT [/ bin / tini, - ,/usr/local/bin/jenkins.sh]

tini 是一个脚本采用僵尸进程,这是我之前在在Docker中使用主管)中提出的问题。)



所以这取决于你的 ENTRYPOINT r Docker文件:它应该包括正确的命令启动Jenkins。







你也可以在您的docker文件中使用主管或入口点。


不需要使用主管:这就是官方图片中的tini。 / p>


如果我使用官方jenkins映像,配置为自动运行jenkins,我想我可以安装Locustio并启动它'docker exec 然后,对吗?


你不会在同一个图像中安装Locusto,或者你不会使用 docker exec 在Jenkins容器中运行它( docker exec 是为主要用于调试目的而开启的会话)



您将使用 Locust.io image 运行第二个容器。

如果jenkins需要locust.io,可以运行轨迹t.io,然后运行jenkins与 - 链接指令


I installed Jenkins in a Docker container and it does not run automatically. I have to run /etc/init.d/jenkins start . Then all are smooth and nice. All the tutorials that I have followed say that after installation it should run by default , but it doesn't.

Any thoughts?

解决方案

If you like at the Dockerfile of the various Jenkins images (like the official _/jenkins one), you will see why jenkins "runs automatically":

COPY jenkins.sh /usr/local/bin/jenkins.sh
ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"]

(tini is a script to adopt zombie processes, which is an issue I presented before in "Use of Supervisor in docker")

So it depends on the ENTRYPOINT of your Dockerfile: it should include the right command to start Jenkins.


Also you can either use supervisor or entrypoint in your docker file.

No need to use supervisor: that is what tini is for in the official image.

If I use the official jenkins image, which is configured to run jenkins automatically, I suppose I could install Locustio and start it with 'docker exec' afterwards, right?

You wouldn't install Locusto in the same image, or you wouldn't use docker exec to run it in the Jenkins container (docker exec is for opening a session mainly for debug purpose)

You would use a Locust.io image to run a second container.
If jenkins needs locust.io, you could run locust.io first, then run jenkins with --link directive.

这篇关于安装在Docker容器后,Jenkins不会自动运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆