Docker Install Jenkins
The Blue Ocean suite of plugins are not bundled with official Jenkins Docker image (jenkins/jenkins), which is available from the Docker Hub repository. Read more about running Jenkins and Blue Ocean inside Docker in the Docker section of the Installing Jenkins page. Follow the instructions for creating a docker image that can be used as a Jenkins Agent; Docker Environment. Follow the installation steps on the docker website. If your Jenkins instance is not on the same OS as the docker install, you will need to open the docker TCP port so that Jenkins can communicate with the docker daemon. Sep 01, 2020 We should get permission denied on docker.sock. If we run that command with sudo, it will work. There is docker user’s group with required permissions, so we add jenkins user to that group and restart docker: usermod -aG docker jenkins sudo service docker restart. We need to logout and login again, and we’ll rerun docker ps. Aug 20, 2020 The resource utilization of the Jenkins slaves is very less if you do not have builds happening continuously. In this scenario, it is better to use ephemeral Docker containers as Jenkins build slaves for better resource utilization. As you know, spinning up a new container takes less than a minute; every build spins up a new container, builds the project, and is destroyed. This way, you can.
- Installing Blue Ocean
This section describes how to get started with Blue Ocean in Jenkins. Itincludes instructions for setting up Blue Ocean onyour Jenkins instance as well as how toaccess the Blue Ocean UI andreturn to the Jenkins classic UI.
Installing Blue Ocean
Blue Ocean can be installed using the following methods:
As a suite of plugins on anexisting Jenkins instance, or
As part of Jenkins in Docker.
On an existing Jenkins instance
When Jenkins is installed on most platforms, theBlue Ocean plugin and all its other dependent plugins (whichform the Blue Ocean 'suite of plugins') are not installed by default.
To install the Blue Ocean suite of plugins on an existing Jenkins instance, yourJenkins instance must be running Jenkins 2.7.x or later.
Plugins can be installed on a Jenkins instance by any Jenkins user who has theAdminister permission (set through Matrix-based security). Jenkins userswith this permission can also configure the permissions of other users on theirsystem. Read more about this in theAuthorization section ofManaging Security.
To install the Blue Ocean suite of plugins to your Jenkins instance:
If required, ensure you are logged in to Jenkins (as a user with theAdminister permission).
From the Jenkins home page (i.e. the Dashboard of the Jenkins classic UI),click Manage Jenkins on the left and then Manage Plugins in the center.
Click the Available tab and type
blue ocean
into the Filter text box,which filters the list of plugins to those whose name and/or descriptioncontains the words 'blue' and 'ocean'.Select the Blue Ocean plugin’s check box near the top of the the Install column and then click either the Download now and install after restart button (recommended) or the Install without restart button at the the end of the page.
Notes:There is no need to select the check boxes of the other plugins in thisfiltered list because the main Blue Ocean plugin has other plugindependencies (constituting the Blue Ocean suite of plugins) which willautomatically be selected and installed when you click one of these 'Install'buttons.
If you chose the Install without restart button, you may need to restartJenkins in order to gain full Blue Ocean functionality.
Read more about how to install and manage plugins in theManaging Plugins page.
Blue Ocean requires no additional configuration after installation, and existingPipelines projects and other items such as freestyle projects will continue towork as usual.
Be aware, however, that the first time aPipeline is created in Blue Ocean for a specific Gitserver (i.e. GitHub, Bitbucket or an ordinary Git server), Blue Ocean promptsyou for credentials to access your repositories on the Git server in order tocreate Pipelines based on those repositories. This is required since Blue Oceancan write Jenkinsfile
s to your repositories.
As part of Jenkins in Docker
The Blue Ocean suite of plugins are not bundled with official Jenkins Docker image(jenkins/jenkins
),which is available from the Docker Hub repository.
Read more about running Jenkins and Blue Ocean inside Docker in theDocker section of theInstalling Jenkins page.
Accessing Blue Ocean
Once a Jenkins environment has Blue Ocean installed, after logging in to theJenkins classic UI, you can access the Blue Ocean UI by clicking Open BlueOcean on the left.
Alternatively, you can access Blue Ocean directly by appending /blue
to theend of your Jenkins server’s URL - e.g. https://jenkins-server-url/blue
.
already has existing Pipeline projects or other items present, then theBlue Ocean Dashboard is displayed.
is new or has no Pipeline projects or other items configured, then Blue Oceandisplays a Welcome to Jenkins box with a Create a new Pipeline button youcan use to begin creating a new Pipeline project. Read more about this inCreating a Pipeline.
Navigation bar
The Blue Ocean UI has a navigation bar along the top of its interface, whichallows you to access the different views and other features of Blue Ocean.
The navigation bar is divided into two sections - a common section along the topof most Blue Ocean views and a contextual section below. The contextual sectionis specific to the current Blue Ocean page you are viewing.
The navigation bar’s common section includes the following buttons:
Jenkins logo - takes you to the Dashboard, or reloadsthis page if you are already viewing it.
Pipelines - also takes you to the Dashboard, or does nothing if you arealready viewing the Dashboard. This button serves a different purpose when youare viewing a Pipeline run details page.
Administration - takes you to the Manage Jenkins pageof the Jenkins classic UI.
Note: This button is not available if your Jenkins user does not have theAdminister permission (set through Matrix-based security). Read more aboutthis in the Authorization sectionof Managing Security.Go to classic icon - takes you back to the Jenkins classic UI. Read moreabout this in Switching to the classic UI.
Logout - Logs out your current Jenkins user and returns to the Jenkins loginpage.
Views that use the standard navigation bar will add another bar below it with options specific to that view.Some views replace the common navigation bar with one specifically suited to that view.
Switching to the classic UI
Blue Ocean does not support some legacy or administrative features of Jenkinsthat are necessary to some users.
If you need to leave the Blue Ocean user experience to access these features,click the Go to classic icon at the top of common section of Blue Ocean’snavigation bar.
Clicking this button takes you to the equivalent page in the Jenkins classic UI,or the most relevant classic UI page that parallels the current page in BlueOcean.
Please submit your feedback about this page through thisquick form.
Alternatively, if you don't wish to complete the quick form, you can simplyindicate if you found this page helpful?
See existing feedback here.
Overview
This plugin allows containers to be dynamically provisioned as Jenkins nodes using Docker. It is a Jenkins Cloud plugin for Docker.
The aim of this docker plugin is to be able to use a Docker host to dynamically provision a docker container as a Jenkins agent node, let that run a single build, then tear-down that node, without the build process (or Jenkins job definition) requiring any awareness of docker.
The Jenkins administrator configures Jenkins with knowledge of one or more docker hosts (or swarms), knowledge of one or more 'templates' (which describe the labels/tags that this template provides, the docker image, how to start it, etc) and Jenkins can then run docker containers to provide Jenkins (agent) Nodes on which Jenkins can run builds.
See also
- Support and contribution guide
Note: There is more than one docker plugin for Jenkins. While this can be confusing for end-users, it's even more confusing when end users report bugs in the wrong place. e.g. if you are using Jenkins pipeline / workflow / Jenkinsfile builds with code including terms like docker.withDockerRegistry
or docker.image
etc then you're using the docker-workflow
plugin and should go to its repository instead of this one.
Note: This plugin does not provide a Docker daemon; it allows Jenkins to use a docker daemon. i.e. Once you've installed docker on your OS, this plugin will allow Jenkins to use it.
A quick setup is :
- get a docker environment running
- follow the instructions for creating a docker image that can be used as a Jenkins Agent
Docker Environment
Follow the installation steps on the docker website.
If your Jenkins instance is not on the same OS as the docker install, you will need to open the docker TCP port so that Jenkins can communicate with the docker daemon. This can be achieved by editing the docker config file and setting (for example)
The docker configuration file location will depend your system, but it is likely to be /etc/init/docker.conf
, /etc/default/docker
or /etc/default/docker.io
.
Multiple Docker Hosts
If you want to use more than just one physical node to run containers, you can use Docker Swarm Standalone or you can define more than one docker 'cloud'. The docker engine swarm mode API is not supported (at present; enhancement contributions would be welcomed).
To use the standalone swarm, follow docker swarm standalone instructions and configure Jenkins with the swarm's API endpoint.
Jenkins Configuration
Docker plugin is a 'Cloud' implementation. You'll need to edit Jenkins system configuration (Jenkins -> Manage -> System configuration) and add a new Cloud of type 'Docker'.
Configure Docker (or Swarm standalone) API URL with required credentials. The test button lets you check the connection.
Then configure Agent templates, assigning them labels that you can use so your jobs select the appropriate template, and set the docker container to be run with whatever container settings you require.
Creating a docker image
You need a docker image that can be used to run Jenkins agent runtime. Depending on the launch method you select, there's some prerequisites for the Docker image to be used:
Docker Install Jenkins Plugins
Launch via SSH
- sshd server and a JDK installed. You can use jenkins/ssh-agent as a basis for a custom image.
- a SSH key (based on unique Jenkins master instance identity) can be injected in container on startup, you don't need any credential set as long as you use standard openssl sshd.
For backward compatibility or non-standard sshd packaged in your docker image, you also have option to provide manually configured ssh credentials - Note: If the docker container's host SSH key is not trusted by Jenkins (usually the case) then you'll need to set the SSH host key verification method to 'non-verifying'.
Launch via JNLP
- a JDK installed. You can use jenkins/inbound-agent as a basis for a custom image.
- Jenkins master URL has to be reachable from container.
- container will be configured automatically with agent's name and secret, so you don't need any special configuration of the container.
Launch attached
- a JDK installed. You can use jenkins/agent as a basis for a custom image.
To create a custom image and bundle your favorite tools, create a Dockerfile
with the FROM
to point to one of the jenkins/*-agent reference images, and install everything needed for your own usage, e.g.
Docker Install Jenkins Net Worth
Note on ENTRYPOINT
Avoid overriding the docker command, as the SSH Launcher relies on it.
You can use an Entrypoint to run some side service inside your build agent container before the agent runtime starts and establish a connection ... but you MUST ensure your entrypoint eventually runs the passed command:
Further information
More information can be obtained from the online help built into the Jenkins WebUI. Most configurable fields have explanatory text. This, combined with knowledge of docker itself, should answer most questions.
Docker Install Windows
Jenkins can be configured using Groovy code, and the docker plugin is no exception. For example, this configuration script could be run automatically upon Jenkins post-initialization or through the Jenkins script console. If run, this script will configure the docker-plugin to look for a docker daemon running within the same OS as the Jenkins master (connecting to Docker service through unix:///var/run/docker.sock
) and with the containers connecting to Jenkins using the 'attach' method.