...
I am personally still on the fence about whether it would be beneficial or detrimental to give the user access to the Docker CLI, so I have foregone that as a possible pro / con in the following scenarios.
Table of Contents |
---|
Testing Docker on Jenkins
Upon first starting Jenkins, you will be asked to enter the admin password that has been printed to the Jenkins log file.
After entering this admin password, you will be prompted to set up an administrative user - you can skip this for now and continue as "admin", whose password was printed in the log.
Plugins
You will be asked if you want the recommended plugins or if you want to select your own - go ahead and select the recommended plugins and you should see them slowly install one by one.
You can install new plugins at any time by choosing "Manage Jenkins" from the dashboard and choosing to "Manage Plugins" from the menu.
Create a Job
Once Jenkins is ready, you will be dropped at the Dashboard with a "create new job" link in the center of the page.
- Click this link and set up a new "Freestyle job" - name the new job whatever you would like and click "Ok"
- Under Point this build job at the Git repository containing the Dockerfile you would like to build (for example, https://github.com/bodom0015/jenkins-experiment)
Scroll down and add a build step of "Execute shell":
Code Block language bash docker build -t test .
Click Apply / Save
You should be dropped at the "Job Details" screen viewing your newly created job
Run a Build
On the "Job Details" screen, you will see a "Build Now" button on the left side. Click this button to perform a new build.
After a few seconds, you will see your new build status appear under the Build Progress queue.
Click the link to navigate to the "Build Details" screen, where you can view more details about a particular run of a build job.
Click the "Console Output" link on the left side to view the output of this build job.
If a build fails, you will likely need to view this output in order to fix the broken build.
Solution A: Per-User Docker Sidecar
...
- lightweight - no service(s) required to run when no jobs are building
- User cannot access the raw Docker socket used by Kubernetes
Cons:
- No access to Docker CLIrequires user to manually set up the build in order to integrate back into NDS Labstracking of build history, status, queues, etc
Result: Ideal and seemingly low-effort solution
Solution B: Per-User Docker +
...
Jenkins Spec
Summary: Allow user to run and manage their own Jenkins instance using their personal docker instance/socket
...
- CI is very complex - we don't want to be in the business of supporting / fixing Jenkins problems
- we would need to enforce auth, although the 2.7.1 build of jenkins used for the dind tag makes you set up an admin user on first-run
- requires user to manually set up the build in order to integrate back into NDS Labs
Result: I feel like this should be a service that we offer to host for themon NDS Labs, but not necessarily force it on users or manage it for them
Solution C: Centralized Internal
...
Jenkins
Summary: Run a centralized jenkins instance within Kubernetes to run Docker builds on all users' behalf
...
Result: Tight Coupling => Not Ideal
Solution D: Exo-Kubernetes
...
Jenkins
Summary: Spin up a raw VM on Nebula and run a jenkins instance on it outside of Kubernetes
...