9707. Installing Jenkins in Docker
Docker and Jenkins

Introduce how to create Jenkins container in Docker.

1. What is Jenkins?

Jenkins is a powerful application that allows continuous integration and continuous delivery of projects, regardless of the platform you are working on. It is a free source that can handle any kind of build or continuous integration. You can integrate Jenkins with a number of testing and deployment technologies.

2. Creating Jenkins Container in Docker

2.1 Installing Docker and Kitematic

If you haven’t installed Docker and Kitematic, please install Docker Toolbox by referring to another posting Installing Docker Toolbox and Kitematic on Mac.

2.2 Creating Jenkins Container

Search jenkins in Kitematic, select the official image, and click Create button. image Jenkins image will be downloaded and a Jenkins container will be created and running. image

2.3 Setting up Jenkins

Click the Preview button, web browser will be opened to access Jenkins application. You need to find the password in the given file to unlock Jenkins. image Open container terminal by clicking on the ‘EXEC’ button in Kitematic. Run the following commands to get the password from secret file initialAdminPassword.

$ cd var/jenkins_home/secrets/
$ more initialAdminPassword

image Copy this password and paste it to the input box in Getting Started page, continue. image In the next page, select ‘Install Suggested Plugins’. image Jenkins starts to install plugins. image In the next page, you need to create an admin user. image Setup is complete, ready for use. image Finally, we see the homepage of Jenkins, which is hosted in Docker Container. image

2.4 Commands for Jenkins

The following commands when appended to the Jenkins instance URL will carry out the relevant actions on the Jenkins instance.

  • - full list of commands
  • - restart jenkins

3. References