Kostas Demiris
Kostas Demiris

Reputation: 3611

Jenkins does not run automatically after install in Docker container

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?

Upvotes: 1

Views: 1815

Answers (2)

VonC
VonC

Reputation: 1323793

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.

Upvotes: 2

Abhijeet Kamble
Abhijeet Kamble

Reputation: 3201

Simple is to use official image of jenkins on docker hub. Also you can either use supervisor or entrypoint in your docker file.

Upvotes: 0

Related Questions