Install Docker On Jenkins Container

Step by step guide to install Jenkins on ubuntu server (LTS version) with suggested plugins, user creation, important configuration, and Docker-based installation. By Tiara Maulid April 28, 2021. Automate jenkins setup with docker docker jenkins tutorial on windows to install jenkins in a docker container highly resilient jenkins using docker swarm docker container install python3. How To Update Jenkins In Docker Container Ngdeveloper. Ci Cd Using Jenkins And Docker Devops4solutions. In this Docker Jenkins Tutorial, we explained how to setup Jenkins in Docker on Windows. We can summarize it into the docker installation, the share of the drive, the installation of the docker container, the unlock, and the plugin installation in Jenkins. Now, you are all set to start with Continuous Integration, on your own PC. Add Jenkins user in docker group in the ubuntu container so as DockerPlugin can access docker binary to execute docker command by “jenkins” user: user mod -a -G docker jenkins. Commit the ubuntu container as docker image, for example, make the image name as jenkins-slave: docker commit container ID jenkins-slave. STEP 2: PULL AND RUN THE CLOUDBEES JENKINS CONTAINER. Stay in your Docker terminal window. Pull Jenkins from the public repo by running: docker pull jenkins/jenkins docker run -p 8080:8080 -name=jenkins-master jenkins/jenkins. Note that the “Jenkins initial setup” message in your shell window will generate a password for you.

  1. Install Docker On Jenkins Container Box
  2. Install Docker On Jenkins Container Model

1、 Pull the Jenkins image and use the following command to install the latest version. If there is no version number, it is not the latest version. Many plug-ins can not be installed. It is troublesome to upgrade Jenkins in docker environment.


be careful:If the installation is time-consuming or cannot be pulled down, configuring the docker to obtain the alicloud address of the image can speed up the image download. The configuration steps and contents are as follows:

Then save and exit.

2、 Pull the image and pull the image successfully, as shown in the figure:

1. You can use the command to check whether the image exists

be careful:TAG The latest version number of Jenkins is LTS

2. Check out Jenkins detailed information

be careful:[IMAGE ID] In the mirror IMAGE ID

3、 Create a data mount directory (to ensure that the data can be recovered after the service is suspended)

4、 Start Jenkins container

Command explanation:

To check whether the startup is successful, use the following command:

5、 Enter IP + port in browser ( IP deployment Jenkins server address, port is the host port in the command), after a long wait, enter the following page:

Install Docker On Jenkins Container

The administrator password is needed here. The password is inside the Jenkins container. Use the command Get the initial password of the administrator

Enter the password into the administrator password box and click continue to open the following page:

Install Docker On Jenkins Container

6、 If you use it for the first time, it is recommended Install recommended plug-ins , Then enter the following page and wait for installation

7、 After installation, click continue to enter the following page, create an account, click save and finish, or use the admin account to continue.

1. Enter the following page:

2. Click save and finish to enter the following page:

3. Click to start using Jenkins

So far: Jenkins installation is complete

8、 Some people feel uncomfortable looking at English, so they can install Chinese plug-ins to solve the problem

1. Enter Manager jenkins menu

2. Enter the global tool configuration menu, select the red area, click apply, and then click save.

3. Enter manager Jenkins, and then click manager plugins menu

4. Click the optional plug-ins to search in the filter Localization: Chinese (Simplified) , Click Install directly. After installation, it will be found in installed.

5. After the installation, restart Jenkins. When you enter the page, Chinese will be displayed, as shown in the figure

The author of this paper:Soul haoxuanWelcome to the official account.

I reserve all rights and interests, please indicate the source of reprint.
Welcome friends with stories and ideas to share with me. You can send them to e-mail: [email protected]

In this blog, we will integrate Jenkins with Docker so that we can have an automation to run the docker container directly from the Jenkins. We will create a freestyle and the pipeline job to run a docker image inside a container through Jenkins

If you want to see the video for this article, click here

If you do not know about Docker and the installation process, refer my docker article for the basic understanding and how to do the docker installation.



  1. Jenkins should be installed
  2. SSH setup between Jenkins and the remote server
  3. Docker should be installed on the server where you need to run a container and the user should be added to the docker group
  4. Setup SSH between Github and Jenkins if you want to use the SSH url instead of https url of your git repo

Install Docker On Jenkins Container Box

Freestyle Job in Jenkins

Let’s create a freestyle job in Jenkins to run a docker commands directly on the Jenkins server and then on the remote server. We don’t need to install the Docker plugin on the Jenkins.

Run Docker on Jenkins Server/Agent

We will create a freestyle job and the docker container will run inside a Jenkins server or the agent where job is actually running

  1. Create a freestyle job , select “Execute Shell” option under Build section and use the below commands.

2. This container will run on the Jenkins Server or if you are using agents then on the Jenkins agents


3. Run the job and see the output, you should be able to see the below output

Run Docker on Remote Host

We will create a freestyle job and the docker container will run on the remote hosts where your application should be deployed

  1. Create a freestyle job , select “Execute Shell” option under Build section and use the below commands
  2. Here, we will be using private/public IP of the remote server and the user for which we have established the SSH connection

3. Make sure to add jenkins user to the docker group on the remote hosts as well.

4. Output of the job

Pipeline Job in Jenkins

  1. Use this git repo
  2. Create a Jenkinsfile as shown below

3. Create a pipeline job and use this git repo and trigger the build

You should be able to success output and the pipeline job like this

Docker Troubleshooting

If you see the below error it means docker service is not running on the machine. Start the docker service and try the build again

Install Docker On Jenkins Container Model

5. If you see the below error “ Permission Denied”

then add jenkins user to the docker group and restart the jenkins service as shown below :

Congratulations, you have successfully learnt how to Integrate Jenkins with Docker and run the docker container in an automated fashion using CI/CD.