How to install Jenkins using Docker

How to install Jenkins using Docker

1. Pull the image

The version I installed here is 2.222.3-centos. You can get the version you need here: https://hub.docker.com/_/jenkins?tab=tags

ocker pull jenkins/jenkins:2.222.3-centos

2. Create a local data volume

The path I map the local data volume to is /data/jenkins_home/. You can modify it if you want to put it somewhere else.

-p /data/jenkins_home/

The directory permissions need to be modified because when mapping the local data volume, the owner of the /data/jenkins_home/ directory is the root user, and the uid of the jenkins user in the container is 1000.

-R 1000:1000 /data/jenkins_home/

3. Create a container

docker run -d --name jenkins -p 8040:8080 -p 50000:50000 -v /data/jenkins_home:/var/jenkins_home jenkins/jenkins:2.222.3-centos

illustrate:

  • The -d flag allows the docker container to run in the background
  • --name defines a container name. If not specified, a random string will be automatically generated as the UUID
  • -p 8040:8080 port mapping. My local port 8080 is occupied, so I just mapped a port 8040.
  • -p 50000:50000 port mapping
  • -v /data/jenkins_home:/var/jenkins_home binds a data volume, /data/jenkins_home is the local data volume just created

4. Configure Jenkins

1. Open Jenkins

Access http://192.168.1.106:8040/ (replace with your own IP and port) through the browser to enter the initial page. If Jenkins has not yet started, the following content will be displayed

2. Enter the administrator password

Here you are required to enter the initial administrator password. According to the prompt, the password is in the file /var/jenkins_home/secrets/initialAdminPassword. Note that this path is in the Docker container, so we get it through the following command

ker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword
85770376692448b7b6a8e301fb437848

Don't forget that we mapped the local data volume /data/jenkins_home/, so you can also output it with the following command

ata/jenkins_home/secrets/initialAdminPassword 
85770376692448b7b6a8e301fb437848

After entering your password, click Continue

3. Install plugins

Select the recommended plugins to install here, and Jenkins will automatically start installing them. If the plugin installation is slow, please refer to Solve the problem of Jenkins plugin installation being slow (Linux)

After the installation is complete, it will automatically jump to the next step

4. Create an administrator

5. Instance Configuration

Just pay attention to the IP address and port

6. Configuration completed

Notice:

The Jenkins initialization page accessed by 360 browser is in English. Please use Chrome browser instead, which must be in Chinese, so it won’t look uncomfortable.

Reference:
https://segon.cn/install-jenkins-using-docker.html

This is the end of this article about installing Jenkins with Docker. For more information about installing Jenkins with Docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed process of installing Jenkins-2.249.3-1.1 with Docker
  • Practical notes on installing Jenkins with docker-compose
  • A detailed tutorial on how to install Jenkins on Docker for beginners
  • Detailed tutorial on installing the jenkins container in a docker environment
  • Install Jenkins with Docker and solve the problem of initial plugin installation failure
  • Sample code for installing Jenkins using Docker
  • Docker deployment and installation steps for Jenkins

<<:  Vue handwriting loading animation project

>>:  Analysis and solution of a MySQL slow log monitoring false alarm problem

Recommend

Solutions to VMware workstation virtual machine compatibility issues

How to solve VMware workstation virtual machine c...

What is BFC? How to clear floats using CSS pseudo elements

BFC Concept: The block formatting context is an i...

Detailed example of reading speed of js objects

1. Accessing literals and local variables is the ...

MySQL isolation level detailed explanation and examples

Table of contents 4 isolation levels of MySQL Cre...

Detailed explanation of Linux command file overwrite and file append

1. The difference between the command > and &g...

HTML implementation of a simple calculator with detailed ideas

Copy code The code is as follows: <!DOCTYPE ht...

Guide to using env in vue cli

Table of contents Preface Introduction-Official E...

How to enable remote access in Docker

Docker daemon socket The Docker daemon can listen...

Centos7 installation of Nginx integrated Lua sample code

Preface The computer I use is a Mac, and the oper...

The difference between the four file extensions .html, .htm, .shtml and .shtm

Many friends who have just started to make web pag...

How to create your own image using Dockerfile

1. Create an empty directory $ cd /home/xm6f/dev ...

Detailed steps for adding hosts you need to monitor in zabbix

Add monitoring host Host 192.168.179.104 is added...

How to change the mysql password on the Xampp server (with pictures)

Today, I found out while working on PHP that if w...

Solve the problem of setting Chinese language pack for Docker container

If you use docker search centos in Docker Use doc...