-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-29239] Containerized Jenkins via Data Volume Container (--vo… #38
base: master
Are you sure you want to change the base?
Conversation
…lumes-from) This patch adds support for Docker Data Volume Containers (https://docs.docker.com/engine/userguide/dockervolumes/#creating-and-mounting-a-data-volume-container) and a "Jenkins dirs in Data Volume Container" checkbox, which, when used together, allows docker-custom-build-environment to be used when Jenkins itself is running in a Docker container. To fully accomplish this, create a Data Volume Container named 'jenkinsdata' which exposes volumes '/var/jenkins_home' and '/tmp'. Mount these volumes in the 'jenkinsmaster' container via `--volumes-from jenkinsdata`. Once 'jenkinsmaster' is up and running, create a job that uses the docker-custom-build-environment plugin and mount the same volumes by specifying 'jenkinsdata' in the Data Volume Container Name field. To finish, make sure the "Jenkins dirs in Data Volume Container" (which prevents the Jenkins workspace and /tmp dirs from being mounted from the Docker host) checkbox is checked, and you will now be able to successfully run your build from within a Docker container.
Thank you for this pull request! Please check this document for how the Jenkins project handles pull requests. |
I had something comparable in mind, but using a distinct approach:
|
OK, so, to clarify, you are suggesting that the |
@superflav Any chance you have had any more time to look at this? I'm blocked by this issue as well and would love to see this pull request get merged! |
@superflav I don't have short terms bandwidth to work on this, so feel free to start working on this |
@superflav Thanks for the above patch, it works very well with Jenkins setup, where Jenkins itself is running in a Docker container.
So it would be great, if you can get this PR merged after resolving conflicts. |
A better approach imho is to detect the build is ran within a container (can just check for |
@superflav : Do you have any plans to work on the change which @ndeloof suggested.? I would like to see this PR merged. |
@bincy1234, I don't have time right now, but you can take it over if you want. Might be best to just scrap what I have here and instead follow along with what the |
If I can find some time to work on this, I am happy to do it. |
…lumes-from)
This patch adds support for Docker Data Volume Containers (https://docs.docker.com/engine/userguide/dockervolumes/#creating-and-mounting-a-data-volume-container) and a "Jenkins dirs in Data Volume Container" checkbox, which, when used together, allows docker-custom-build-environment to be used when Jenkins itself is running in a Docker container.
To fully accomplish this, create a Data Volume Container named 'jenkinsdata' which exposes volumes '/var/jenkins_home' and '/tmp'. Mount these volumes in the 'jenkinsmaster' container via
--volumes-from jenkinsdata
. Once 'jenkinsmaster' is up and running, create a job that uses the docker-custom-build-environment plugin and mount the same volumes by specifying 'jenkinsdata' in the Data Volume Container Name field. To finish, make sure the "Jenkins dirs in Data Volume Container" (which prevents the Jenkins workspace and /tmp dirs from being mounted from the Docker host) checkbox is checked, and you will now be able to successfully run your build from within a Docker container.