Welcome to Knowledge Base!

KB at your finger tips

This is one stop global knowledge base where you can learn about all the products, solutions and support features.

Categories
All
DevOps-Jenkins
Pipeline Editor

Pipeline Editor

Table of Contents
  • Starting the editor
  • Navigation bar
  • Pipeline Settings
    • Agent
    • Environment
  • Stage editor
  • Stage configuration
  • Step configuration
  • Save Pipeline dialog

The Blue Ocean Pipeline Editor is an easy way for anyone to get started with creating Pipelines in Jenkins. It’s also great for existing Jenkins users to start adopting Pipeline.

Blue Ocean status

Blue Ocean will not receive further functionality updates. Blue Ocean will continue to provide easy-to-use Pipeline visualization, but it will not be enhanced further. It will only receive selective updates for significant security issues or functional defects.

The Pipeline syntax snippet generator assists users as they define Pipeline steps with their arguments. It is the preferred tool for Jenkins Pipeline creation, as it provides online help for the Pipeline steps available in your Jenkins controller. It uses the plugins installed on your Jenkins controller to generate the Pipeline syntax. Refer to the Pipeline steps reference page for information on all available Pipeline steps.

The editor allows users to create and edit Declarative Pipelines and perform actions such as adding stages or configuring parallel tasks, depending on their needs. When the user completes their configuration, the editor saves the Pipeline to a source code repository as a Jenkinsfile . If the Pipeline requires further modification, Blue Ocean makes it easy to jump back into the visual editor to modify the Pipeline at any time.

Blue Ocean Pipeline Editor limitations

The Blue Ocean Pipeline Editor is a great alternative for Jenkins users, but there are some limitations to its functionality:

  • The editor utilizes SCM-based Declarative Pipelines only.

  • User credentials must have write permission.

  • The editor does not have full parity with Declarative Pipeline.

  • The Pipeline is re-ordered and comments are removed.

Starting the editor

To use the editor, a user must first create a Pipeline in Blue Ocean or have at least one existing Pipeline in Jenkins. If editing an existing Pipeline, the credentials for that Pipeline must allow pushing changes to the target repository.

The editor can be launched through the:

  • New Pipeline option from the Blue Ocean dashboard.

  • Branches tab within the Activity view.

  • Edit ( ) in the Pipeline run details view.

The Pipeline editor includes the standard navigation bar at the top, with a local navigation bar below it. The local navigation bar includes:

  • Pipeline Name - This also includes the branch name.

  • Cancel - Discards changes made to the pipeline.

  • Save - Opens the save Pipeline dialog.

Pipeline Settings

By default, the pane on the right side of the editor displays the Pipeline Settings . Selecting an existing stage or adding a stage displays the stage configuration pane instead. To navigate back to the Pipeline Settings pane, select any empty space in the background of the editor. Within the Pipeline Settings pane, there are two sections that are configurable.

Agent

The Agent section controls which agent the Pipeline uses. This performs the same process as the agent directive. The Image field allows users to configure which container image runs when the Pipeline is active.

Environment

The Environment section allows users to configure environment variables for the Pipeline. This is the same process as the environment directive.

Stage editor

The left pane displays the stage editor UI, which allows users to create or add stages of a Pipeline.

Stage editor view of new pipeline.

  • To add a stage to the Pipeline, select the icon to the right of an existing stage. Selecting the icon below an existing stage adds a parallel stage.

  • To delete unwanted stages, use the more menu in the stage configuration pane.

After setting the stage name and saving, the name displays above the stage. Stages that contain incomplete or invalid information display a . Pipelines can have validation errors during editing, but saving is blocked until the errors are fixed.

Stage editor with error displayed.

Stage configuration

Selecting a stage in the editor displays the Stage Configuration pane on the right side of the screen. Here, you can modify the name of the stage, delete the stage, and add steps to a stage.

Stage configuration pane

The name of the stage can be set at the top of the stage configuration pane. The more menu, represented by three dots to the right of the stage name, allows users to delete the currently selected stage. Selecting Add step displays the list of available step types. After selecting a step type, the page displays the step configuration pane.

Step list filtered by 'file'

Step configuration

This pane display is based on the step type selected, and contains the necessary fields or controls.

Step configuration for JUnit step

Be sure to provide a strong name for the step, as the name retains its original configuration. Deleting the step and recreating it is the only way to provide a different name. The more menu, represented by three dots to the right of the step name, allows users to delete the current step. Fields that contain incomplete or invalid information display a . Any validation errors must be addressed before saving.

Step configuration with error

Save Pipeline dialog

Changes to a Pipeline must be saved in source control before running. The Save Pipeline dialog controls the saving of changes to source control.

Save Pipeline dialog

You can optionally enter a description of the changes before saving. The dialog also provides options for saving changes to the same branch or creating a new branch to save to. Selecting Save & run saves any changes to the Pipeline as a new commit, starts a new Pipeline run based on those changes, and navigates to the Activity view for this pipeline.



Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?


See existing feedback here.

Pipeline Run Details View

Pipeline Run Details View

Table of Contents
  • Pipeline Run Status
  • Special cases
    • Pipelines outside of Source Control
    • Freestyle Projects
    • Matrix projects
  • Tabs
    • Pipeline
    • Changes
    • Tests
    • Artifacts

The Blue Ocean Pipeline Run Details view shows the information related to a single Pipeline Run, and allows users to edit or replay that run. Below is a detailed overview of the parts of the Run Details view.

Blue Ocean status

Blue Ocean will not receive further functionality updates. Blue Ocean will continue to provide easy-to-use Pipeline visualization, but it will not be enhanced further. It will only receive selective updates for significant security issues or functional defects.

Overview of the Pipeline Run Details

  1. Run Status - An icon indicating the status of this Pipeline run. The color of the navigation bar matches the status icon.

  2. Pipeline Name - The name of this run’s Pipeline.

  3. Run Number - The id number for this Pipeline run. Id numbers are unique for each Branch and Pull Request of a Pipeline.

  4. View Tabs - Access the Pipeline , Changes , Tests , and Artifacts views with one of the tabs for this run. The default view is "Pipeline".

  5. Re-run Pipeline - Execute this run’s Pipeline again.

  6. Edit Pipeline - Open this run’s Pipeline in the Pipeline Editor.

  7. Configure - Open the Pipeline configuration page in Jenkins.

  8. Go to Classic - Switch to the "Classic" UI view of the details for this run.

  9. Close Details - Closes the Details view and returns the user to the Activity view for this Pipeline.

  10. Branch or Pull Request - The branch or pull request for this run.

  11. Commit Id - The commit id for this run.

  12. Duration - The duration of this run.

  13. Completed Time - When this run was completed.

  14. Change Author - Names of the authors with changes in this run.

  15. Tab View - Shows the information for the selected tab.

Pipeline Run Status

Blue Ocean makes it easy to see the status of the current Pipeline Run, by changing the color of the top menu bar to match the status:

  • Blue for "In progress"

  • Green for "Passed"

  • Yellow for "Unstable"

  • Red for "Failed"

  • Gray for "Aborted"

Special cases

Blue Ocean is optimized for working with Pipelines in Source Control, but can display details for other kinds of projects. Blue Ocean offers the same tabs for all supported projects types, but those tabs display different information depending on the type.

Pipelines outside of Source Control

For Pipelines that are not based in Source Control, Blue Ocean shows the "Commit Id", "Branch", and "Changes", but those fields are left blank. In this case, the top menu bar does not include the "Edit" option.

Freestyle Projects

For Freestyle projects, Blue Ocean offers the same tabs, but the Pipeline tab only displays the console log output. The "Rerun" or "Edit" options are not available in the top menu bar.

Matrix projects

Matrix projects are not supported in Blue Ocean. Viewing a Matrix project will redirect to the "Classic UI" view for that project.

Tabs

Each tab of the Run Detail view provides information on a specific aspect of a run.

Pipeline

Pipeline is the default tab and gives an overall view of the flow of this Pipeline Run. It shows each stage and parallel branch, the steps in those stages, and the console output from those steps. The overview image above shows a successful Pipeline run. If a particular step during the run fails, this tab automatically defaults to showing the console log from the failed step. The image below shows a failed Run.

Failed Run

Changes

The Changes tab displays the information of any changes made between the most recently completed and current runs. This includes the commit id for the change, change author, message, and date completed.

List of Changes for a Run

Tests

The Tests tab shows information about test results for this run. This tab only contains information if a test result publishing step is present, such as the "Publish JUnit test results" ( junit ) step. If no results are recorded, this table displays a message. If all tests pass, this tab will report the total number of passing tests. If there are failures, the tab will display log details from the failures as shown below.

Test Results for Unstable Run

When a previous run has failures, and the current run fixes those failures, this tab notes the fixes and displays their logs.

Test Results for Fixed Run

Artifacts

The Artifacts tab shows a list of any artifacts saved using the "Archive Artifacts" ( archiveArtifacts ) step. Selecting an item in the list downloads it. The full output log from the Run can be downloaded from this list.

List of Artifacts from a Run



Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?


See existing feedback here.

Read article
User Handbook Overview

User Handbook Overview

This page provides an overview of the documentation in the Jenkins User Handbook.

If you want to get up and running with Jenkins, see Installing Jenkins for procedures on how to install Jenkins on your supported platform of choice.

If you are a typical Jenkins user (of any skill level) who wants to know more about Jenkins usage, see Using Jenkins. Also refer to the separate Pipeline and Blue Ocean chapters for more information about these core Jenkins features.

If you are a Jenkins administrator and want to know more about managing Jenkins nodes and instances, see Managing Jenkins.

If you are a system administrator and want to learn how to back-up, restore, maintain as Jenkins servers and nodes, see Jenkins System Administration.



Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?


See existing feedback here.

Read article
Glossary

Glossary

Table of Contents
  • General Terms
  • Build Status

General Terms

Agent

An agent is typically a machine, or container, which connects to a Jenkins controller and executes tasks when directed by the controller.

Artifact

An immutable file generated during a Build or Pipeline run which is archived onto the Jenkins Controller for later retrieval by users.

Build

Result of a single execution of a job

Cloud

A System Configuration which provides dynamic Agent provisioning and allocation, such as that provided by the Azure VM Agents or Amazon EC2 plugins.

Controller

The central, coordinating process which stores configuration, loads plugins, and renders the various user interfaces for Jenkins.

Core

The primary Jenkins application ( jenkins.war ) which provides the basic web UI, configuration, and foundation upon which Plugins can be built.

Downstream

A configured Pipeline or job which is triggered as part of the execution of a separate Pipeline or Job.

Executor

A slot for execution of work defined by a Pipeline or job on a Node. A Node may have zero or more Executors configured which corresponds to how many concurrent Jobs or Pipelines are able to execute on that Node.

Fingerprint

A hash considered globally unique to track the usage of an Artifact or other entity across multiple Pipelines or jobs.

Folder

An organizational container for Pipelines and/or jobs, similar to folders on a file system.

Item

An entity in the web UI corresponding to either a: Folder, Pipeline, or job.

Jenkins URL

The main url for the jenkins application, as visited by a user. e.g. https://ci.jenkins.io/

Job

A user-configured description of work which Jenkins should perform, such as building a piece of software, etc.

Kubernetes

Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerized applications. See Installing Jenkins / Kubernetes for more info.

Label

User-defined text for grouping Agents, typically by similar functionality or capability. For example linux for Linux-based agents or docker for Docker-capable agents.

LTS

A long-term support Release line of Jenkins products, becoming available for downloads every 12 weeks. See this page for more info.

Master

A deprecated term, synonymous with Controller.

Node

A machine which is part of the Jenkins environment and capable of executing Pipelines or jobs. Both the Controller and Agents are considered to be Nodes.

Project

A deprecated term, synonymous with job.

Pipeline

A user-defined model of a continuous delivery pipeline, for more read the Pipeline chapter in this handbook.

Plugin

An extension to Jenkins functionality provided separately from Jenkins Core.

Publisher

Part of a Build after the completion of all configured Steps which publishes reports, sends notifications, etc. A publisher may report Stable or Unstable result depending on the result of its processing and its configuration. For example, if a JUnit test fails, then the whole JUnit publisher may report the build result as Unstable.

Resource Root URL

A secondary url used to serve potentially untrusted content (especially build artifacts). This url is distinct from the Jenkins URL.

Release

An event, indicating availability of Jenkins distribution products or one of Jenkins plugins. Jenkins products belong either to LTS or weekly Release lines.

Stage

stage is part of Pipeline, and used for defining a conceptually distinct subset of the entire Pipeline, for example: "Build", "Test", and "Deploy", which is used by many plugins to visualize or present Jenkins Pipeline status/progress.

Step

A single task; fundamentally steps tell Jenkins what to do inside of a Pipeline or job. See Pipelines / Getting Started and Pipeline / Using a jenkinsfile for more info.

Trigger

A criteria for triggering a new Pipeline run or job.

Update Center

Hosted inventory of plugins and plugin metadata to enable plugin installation from within Jenkins.

Upstream

A configured Pipeline or job which triggers a separate Pipeline or Job as part of its execution.

View

A way of displaying the data of Jenkins in a dashboard style. This is an extensible object, so there are lots of different ways to list jobs, show trends, and analyze data.

Workspace

A disposable directory on the file system of a Node where work can be done by a Pipeline or job. Workspaces are typically left in place after a Build or Pipeline run completes unless specific Workspace cleanup policies have been put in place on the Jenkins Controller.

Build Status

Aborted

The Build was interrupted before it reaches its expected end. For example, the user has stopped it manually or there was a time-out.

Failed

The Build had a fatal error.

Stable

The Build was Successful and no Publisher reports it as Unstable.

Successful

The Build has no compilation errors.

Unstable

The Build had some errors but they were not fatal. A Build is unstable if it was built successfully and one or more publishers report it unstable. For example if the JUnit publisher is configured and a test fails then the Build will be marked unstable.



Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?


See existing feedback here.

Read article
Jenkins Handbook

Jenkins Handbook

  1. User Handbook Overview
  2. Installing Jenkins
    1. Docker
    2. Kubernetes
    3. Linux
    4. macOS
    5. Windows
    6. Other Systems
    7. WAR file
    8. Other Servlet Containers
    9. Offline Installations
    10. Initial Settings
  3. Using Jenkins
    1. Using credentials
    2. Search Box
    3. Referencing another project by name
    4. Aborting a build
    5. Fingerprints
    6. Using local language
    7. Change time zone
    8. Remote Access API
    9. Executor Starvation
    10. Using Jenkins agents
    11. Using JMeter with Jenkins
  4. Pipeline
    1. Getting started with Pipeline
    2. Using a Jenkinsfile
    3. Running Pipelines
    4. Branches and Pull Requests
    5. Using Docker with Pipeline
    6. Extending with Shared Libraries
    7. Pipeline Development Tools
    8. Pipeline Syntax
    9. Pipeline Best Practices
    10. Scaling Pipelines
    11. Pipeline CPS Method Mismatches
  5. Blue Ocean
    1. Getting started with Blue Ocean
    2. Creating a Pipeline
    3. Dashboard
    4. Activity View
    5. Pipeline Run Details View
    6. Pipeline Editor
  6. Managing Jenkins
    1. Configuring the System
    2. Configuration as Code
    3. Managing Tools
    4. Managing Plugins
    5. About Jenkins
    6. System Information
    7. Jenkins Features Controlled with System Properties
    8. Change System Time Zone
    9. Jenkins CLI
    10. Script Console
    11. Groovy Hook Scripts
    12. Managing Nodes
    13. In-process Script Approval
    14. Manage Users
    15. Themes for user interface
    16. User Content
    17. Spawning Processes From Build
  7. Securing Jenkins
    1. Access Control
    2. Securing Jenkins
    3. Managing Security
    4. Controller Isolation
    5. CSRF Protection
    6. Rendering User Content
    7. Access Control for Builds
    8. Handling Environment Variables
    9. Markup Formatters
    10. Exposed Services and Ports
  8. System Administration
    1. Backing-up/Restoring Jenkins
    2. Monitoring Jenkins
    3. Administering Jenkins on Kubernetes
    4. Managing Jenkins with Chef
    5. Managing Jenkins with Puppet
    6. Viewing logs
    7. Authenticating scripted clients
    8. Reverse proxy configuration
    9. Reverse proxy - Issues
    10. Managing systemd services
  9. Scaling Jenkins
    1. Architecting for Scale
    2. Hardware Recommendations
    3. Architecting for Manageability
    4. Scaling Jenkins on Kubernetes
  10. Troubleshooting Jenkins
    1. Diagnosing Errors
    2. Obtaining a thread dump
  11. Glossary
Read article
Docker

Docker

Table of Contents
  • Installing Docker
  • Prerequisites
    • Downloading and running Jenkins in Docker
    • On macOS and Linux
    • On Windows
  • Accessing the Docker container
  • Accessing the Docker logs
  • Accessing the Jenkins home directory
  • Post-installation setup wizard
    • Unlocking Jenkins
    • Customizing Jenkins with plugins
    • Creating the first administrator user

Docker is a platform for running applications in an isolated environment called a "container" (or Docker container). Applications like Jenkins can be downloaded as read-only "images" (or Docker images), each of which is run in Docker as a container. A Docker container is in effect a "running instance" of a Docker image. From this perspective, an image is stored permanently more or less (i.e. insofar as image updates are published), whereas containers are stored temporarily. Read more about these concepts in the Docker documentation’s Getting Started, Part 1: Orientation and setup page.

Docker’s fundamental platform and container design means that a single Docker image (for any given application like Jenkins) can be run on any supported operating system (macOS, Linux and Windows) or cloud service (AWS and Azure) which is also running Docker.

Installing Docker

To install Docker on your operating system, follow "prerequisites" section of the Guided Tour page

As an alternative solution you can visit the Dockerhub and select the Docker Community Edition suitable for your operating system or cloud service. Follow the installation instructions on their website.

If you are installing Docker on a Linux-based operating system, ensure you configure Docker so it can be managed as a non-root user. Read more about this in Docker’s Post-installation steps for Linux page of their documentation. This page also contains information about how to configure Docker to start on boot.

Prerequisites

Minimum hardware requirements:

  • 256 MB of RAM

  • 1 GB of drive space (although 10 GB is a recommended minimum if running Jenkins as a Docker container)

Recommended hardware configuration for a small team:

  • 4 GB+ of RAM

  • 50 GB+ of drive space

Comprehensive hardware recommendations:

  • Hardware: see the Hardware Recommendations page

Software requirements:

  • Java: see the Java Requirements page

  • Web browser: see the Web Browser Compatibility page

  • For Windows operating system: Windows Support Policy

  • For Linux operating system: Linux Support Policy

  • For servlet containers: Servlet Container Support Policy

Downloading and running Jenkins in Docker

There are several Docker images of Jenkins available.

The recommended Docker image to use is the Official jenkins/jenkins image (from the Docker Hub repository). This image contains the current Long-Term Support (LTS) release of Jenkins (which is production-ready). However this image doesn’t have docker CLI inside it and is not bundled with frequently used Blue Ocean plugins and features. This means that if you want to use the full power of Jenkins and Docker you may want to go through described below installation process.

A new jenkins/jenkins image is published each time a new release of Jenkins Docker is published. You can see a list of previously published versions of the jenkins/jenkins image on the tags page.

On macOS and Linux

  1. Open up a terminal window.

  2. Create a bridge network in Docker using the following docker network create command:

    docker network create jenkins
  3. In order to execute Docker commands inside Jenkins nodes, download and run the docker:dind Docker image using the following docker run command:

    docker run \
      --name jenkins-docker \(1)
      --rm \(2)
      --detach \(3)
      --privileged \(4)
      --network jenkins \(5)
      --network-alias docker \(6)
      --env DOCKER_TLS_CERTDIR=/certs \(7)
      --volume jenkins-docker-certs:/certs/client \(8)
      --volume jenkins-data:/var/jenkins_home \(9)
      --publish 2376:2376 \(10)
      docker:dind \(11)
      --storage-driver overlay2(12)
    1 ( Optional ) Specifies the Docker container name to use for running the image. By default, Docker will generate a unique name for the container.
    2 ( Optional ) Automatically removes the Docker container (the instance of the Docker image) when it is shut down.
    3 ( Optional ) Runs the Docker container in the background. This instance can be stopped later by running docker stop jenkins-docker .
    4 Running Docker in Docker currently requires privileged access to function properly. This requirement may be relaxed with newer Linux kernel versions.
    5 This corresponds with the network created in the earlier step.
    6 Makes the Docker in Docker container available as the hostname docker within the jenkins network.
    7 Enables the use of TLS in the Docker server. Due to the use of a privileged container, this is recommended, though it requires the use of the shared volume described below. This environment variable controls the root directory where Docker TLS certificates are managed.
    8 Maps the /certs/client directory inside the container to a Docker volume named jenkins-docker-certs as created above.
    9 Maps the /var/jenkins_home directory inside the container to the Docker volume named jenkins-data . This will allow for other Docker containers controlled by this Docker container’s Docker daemon to mount data from Jenkins.
    10 ( Optional ) Exposes the Docker daemon port on the host machine. This is useful for executing docker commands on the host machine to control this inner Docker daemon.
    11 The docker:dind image itself. This image can be downloaded before running by using the command: docker image pull docker:dind .
    12 The storage driver for the Docker volume. See "Docker storage drivers" for supported options.

    Note: If copying and pasting the command snippet above does not work, try copying and pasting this annotation-free version here:

    docker run --name jenkins-docker --rm --detach \
      --privileged --network jenkins --network-alias docker \
      --env DOCKER_TLS_CERTDIR=/certs \
      --volume jenkins-docker-certs:/certs/client \
      --volume jenkins-data:/var/jenkins_home \
      --publish 2376:2376 \
      docker:dind --storage-driver overlay2
  4. Customise official Jenkins Docker image, by executing below two steps:

    1. Create Dockerfile with the following content:

      FROM jenkins/jenkins:2.375.1
      USER root
      RUN apt-get update && apt-get install -y lsb-release
      RUN curl -fsSLo /usr/share/keyrings/docker-archive-keyring.asc \
        https://download.docker.com/linux/debian/gpg
      RUN echo "deb [arch=$(dpkg --print-architecture) \
        signed-by=/usr/share/keyrings/docker-archive-keyring.asc] \
        https://download.docker.com/linux/debian \
        $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
      RUN apt-get update && apt-get install -y docker-ce-cli
      USER jenkins
      RUN jenkins-plugin-cli --plugins "blueocean:1.26.0 docker-workflow:563.vd5d2e5c4007f"
    2. Build a new docker image from this Dockerfile and assign the image a meaningful name, e.g. "myjenkins-blueocean:2.375.1-1":

      docker build -t myjenkins-blueocean:2.375.1-1 .

      Keep in mind that the process described above will automatically download the official Jenkins Docker image if this hasn’t been done before.

  5. Run your own myjenkins-blueocean:2.375.1-1 image as a container in Docker using the following docker run command:

    docker run \
      --name jenkins-blueocean \(1)
      --restart=on-failure \(2)
      --detach \(3)
      --network jenkins \(4)
      --env DOCKER_HOST=tcp://docker:2376 \(5)
      --env DOCKER_CERT_PATH=/certs/client \
      --env DOCKER_TLS_VERIFY=1 \
      --publish 8080:8080 \(6)
      --publish 50000:50000 \(7)
      --volume jenkins-data:/var/jenkins_home \(8)
      --volume jenkins-docker-certs:/certs/client:ro \(9)
      myjenkins-blueocean:2.375.1-1 (10)
    1 ( Optional ) Specifies the Docker container name for this instance of the Docker image.
    2 Always restart the container if it stops. If it is manually stopped, it is restarted only when Docker daemon restarts or the container itself is manually restarted.
    3 ( Optional ) Runs the current container in the background (i.e. "detached" mode) and outputs the container ID. If you do not specify this option, then the running Docker log for this container is output in the terminal window.
    4 Connects this container to the jenkins network defined in the earlier step. This makes the Docker daemon from the previous step available to this Jenkins container through the hostname docker .
    5 Specifies the environment variables used by docker , docker-compose , and other Docker tools to connect to the Docker daemon from the previous step.
    6 Maps (i.e. "publishes") port 8080 of the current container to port 8080 on the host machine. The first number represents the port on the host while the last represents the container’s port. Therefore, if you specified -p 49000:8080 for this option, you would be accessing Jenkins on your host machine through port 49000.
    7 ( Optional ) Maps port 50000 of the current container to port 50000 on the host machine. This is only necessary if you have set up one or more inbound Jenkins agents on other machines, which in turn interact with your jenkins-blueocean container (the Jenkins "controller"). Inbound Jenkins agents communicate with the Jenkins controller through TCP port 50000 by default. You can change this port number on your Jenkins controller through the Configure Global Security page. If you were to change the TCP port for inbound Jenkins agents of your Jenkins controller to 51000 (for example), then you would need to re-run Jenkins (via this docker run …​ command) and specify this "publish" option with something like --publish 52000:51000 , where the last value matches this changed value on the Jenkins controller and the first value is the port number on the machine hosting the Jenkins controller. Inbound Jenkins agents communicate with the Jenkins controller on that port (52000 in this example). Note that WebSocket agents do not need this configuration.
    8 Maps the /var/jenkins_home directory in the container to the Docker volume with the name jenkins-data . Instead of mapping the /var/jenkins_home directory to a Docker volume, you could also map this directory to one on your machine’s local file system. For example, specifying the option
    --volume $HOME/jenkins:/var/jenkins_home would map the container’s /var/jenkins_home directory to the jenkins subdirectory within the $HOME directory on your local machine, which would typically be /Users/<your-username>/jenkins or /home/<your-username>/jenkins . Note that if you change the source volume or directory for this, the volume from the docker:dind container above needs to be updated to match this.
    9 Maps the /certs/client directory to the previously created jenkins-docker-certs volume. This makes the client TLS certificates needed to connect to the Docker daemon available in the path specified by the DOCKER_CERT_PATH environment variable.
    10 The name of the Docker image, which you built in the previous step.

    Note: If copying and pasting the command snippet above does not work, try copying and pasting this annotation-free version here:

    docker run --name jenkins-blueocean --restart=on-failure --detach \
      --network jenkins --env DOCKER_HOST=tcp://docker:2376 \
      --env DOCKER_CERT_PATH=/certs/client --env DOCKER_TLS_VERIFY=1 \
      --publish 8080:8080 --publish 50000:50000 \
      --volume jenkins-data:/var/jenkins_home \
      --volume jenkins-docker-certs:/certs/client:ro \
      myjenkins-blueocean:2.375.1-1
  6. Proceed to the Post-installation setup wizard.

On Windows

The Jenkins project provides a Linux container image, not a Windows container image. Be sure that your Docker for Windows installation is configured to run Linux Containers rather than Windows Containers . See the Docker documentation for instructions to switch to Linux containers. Once configured to run Linux Containers , the steps are:

  1. Open up a command prompt window and similar to the macOS and Linux instructions above do the following:

  2. Create a bridge network in Docker

    docker network create jenkins
  3. Run a docker:dind Docker image

    docker run --name jenkins-docker --rm --detach ^
      --privileged --network jenkins --network-alias docker ^
      --env DOCKER_TLS_CERTDIR=/certs ^
      --volume jenkins-docker-certs:/certs/client ^
      --volume jenkins-data:/var/jenkins_home ^
      --publish 2376:2376 ^
      docker:dind
  4. Customise official Jenkins Docker image, by executing below two steps:

    1. Create Dockerfile with the following content:

      FROM jenkins/jenkins:2.375.1
      USER root
      RUN apt-get update && apt-get install -y lsb-release
      RUN curl -fsSLo /usr/share/keyrings/docker-archive-keyring.asc \
        https://download.docker.com/linux/debian/gpg
      RUN echo "deb [arch=$(dpkg --print-architecture) \
        signed-by=/usr/share/keyrings/docker-archive-keyring.asc] \
        https://download.docker.com/linux/debian \
        $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
      RUN apt-get update && apt-get install -y docker-ce-cli
      USER jenkins
      RUN jenkins-plugin-cli --plugins "blueocean:1.26.0 docker-workflow:563.vd5d2e5c4007f"
    2. Build a new docker image from this Dockerfile and assign the image a meaningful name, e.g. "myjenkins-blueocean:2.375.1-1":

      docker build -t myjenkins-blueocean:2.375.1-1 .

      Keep in mind that the process described above will automatically download the official Jenkins Docker image if this hasn’t been done before.

  5. Run your own myjenkins-blueocean:2.375.1-1 image as a container in Docker using the following docker run command:

    docker run --name jenkins-blueocean --restart=on-failure --detach ^
      --network jenkins --env DOCKER_HOST=tcp://docker:2376 ^
      --env DOCKER_CERT_PATH=/certs/client --env DOCKER_TLS_VERIFY=1 ^
      --volume jenkins-data:/var/jenkins_home ^
      --volume jenkins-docker-certs:/certs/client:ro ^
      --publish 8080:8080 --publish 50000:50000 myjenkins-blueocean:2.375.1-1
  6. Proceed to the Setup wizard.

Accessing the Docker container

If you have some experience with Docker and you wish or need to access your Docker container through a terminal/command prompt using the docker exec command, you can add an option like --name jenkins-tutorial to the docker exec command. That will access the Jenkins Docker container named "jenkins-tutorial".

This means you could access your docker container (through a separate terminal/command prompt window) with a docker exec command like:

docker exec -it jenkins-blueocean bash

Accessing the Docker logs

There is a possibility you may need to access the Jenkins console log, for instance, when Unlocking Jenkins as part of the Post-installation setup wizard.

The Jenkins console log is easily accessible through the terminal/command prompt window from which you executed the docker run …​ command. In case if needed you can also access the Jenkins console log through the Docker logs of your container using the following command:

docker logs <docker-container-name>

Your <docker-container-name> can be obtained using the docker ps command.

Accessing the Jenkins home directory

There is a possibility you may need to access the Jenkins home directory, for instance, to check the details of a Jenkins build in the workspace subdirectory.

If you mapped the Jenkins home directory ( /var/jenkins_home ) to one on your machine’s local file system (i.e. in the docker run …​ command above), then you can access the contents of this directory through your machine’s usual terminal/command prompt.

Otherwise, if you specified the --volume jenkins-data:/var/jenkins_home option in the docker run …​ command, you can access the contents of the Jenkins home directory through your container’s terminal/command prompt using the docker container exec command:

docker container exec -it <docker-container-name> bash

As mentioned above, your <docker-container-name> can be obtained using the docker container ls command. If you specified the --name jenkins-blueocean option in the docker container run …​ command above (see also Accessing the Jenkins/Blue Ocean Docker container ), you can simply use the docker container exec command:

docker container exec -it jenkins-blueocean bash

Post-installation setup wizard

After downloading, installing and running Jenkins using one of the procedures above (except for installation with Jenkins Operator), the post-installation setup wizard begins.

This setup wizard takes you through a few quick "one-off" steps to unlock Jenkins, customize it with plugins and create the first administrator user through which you can continue accessing Jenkins.

Unlocking Jenkins

When you first access a new Jenkins instance, you are asked to unlock it using an automatically-generated password.

  1. Browse to http://localhost:8080 (or whichever port you configured for Jenkins when installing it) and wait until the Unlock Jenkins page appears.

    Unlock Jenkins page

  2. From the Jenkins console log output, copy the automatically-generated alphanumeric password (between the 2 sets of asterisks).

    Copying initial admin password
    Note:

    • The command: sudo cat /var/lib/jenkins/secrets/initialAdminPassword will print the password at console.

    • If you are running Jenkins in Docker using the official jenkins/jenkins image you can use sudo docker exec ${CONTAINER_ID or CONTAINER_NAME} cat /var/jenkins_home/secrets/initialAdminPassword to print the password in the console without having to exec into the container.

  3. On the Unlock Jenkins page, paste this password into the Administrator password field and click Continue .
    Notes:

    • You can always access the Jenkins console log from the Docker logs (above).

    • The Jenkins console log indicates the location (in the Jenkins home directory) where this password can also be obtained. This password must be entered in the setup wizard on new Jenkins installations before you can access Jenkins’s main UI. This password also serves as the default administrator account’s password (with username "admin") if you happen to skip the subsequent user-creation step in the setup wizard.

Customizing Jenkins with plugins

After unlocking Jenkins, the Customize Jenkins page appears. Here you can install any number of useful plugins as part of your initial setup.

Click one of the two options shown:

  • Install suggested plugins - to install the recommended set of plugins, which are based on most common use cases.

  • Select plugins to install - to choose which set of plugins to initially install. When you first access the plugin selection page, the suggested plugins are selected by default.

If you are not sure what plugins you need, choose Install suggested plugins . You can install (or remove) additional Jenkins plugins at a later point in time via the Manage Jenkins > Manage Plugins page in Jenkins.

The setup wizard shows the progression of Jenkins being configured and your chosen set of Jenkins plugins being installed. This process may take a few minutes.

Creating the first administrator user

Finally, after customizing Jenkins with plugins , Jenkins asks you to create your first administrator user.

  1. When the Create First Admin User page appears, specify the details for your administrator user in the respective fields and click Save and Finish .

  2. When the Jenkins is ready page appears, click Start using Jenkins .
    Notes:

    • This page may indicate Jenkins is almost ready! instead and if so, click Restart .

    • If the page does not automatically refresh after a minute, use your web browser to refresh the page manually.

  3. If required, log in to Jenkins with the credentials of the user you just created and you are ready to start using Jenkins!



Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?


See existing feedback here.

Read article