Jenkins via Docker Compose
Installing Jenkins via Docker
Use docker run:
After running the command above, Docker starts to create a new container. Once the Jenkins container is running, take note of the initial admin password displayed on the terminal. The admin password is needed during the Jenkins initial setup.
After the Jenkins container entered the running state, you can now access the Jenkins admin page. If you remember from the command you used to create the container, the port number is 8080. So to access the Jenkins instance, navigate to HTTP://localhost:8080
Note: You can access the Jenkis instance by using IP as well
HTTP://ip-of-server:8080
3. On the Customize Jenkins page, you’ll have the option to Install suggested plugins. These suggested plugin are the plugins that the Jenkins community typically install. If you have a pre-selected set of plugins to install, choose the Select plugins to install option.
For simplicity, the Install suggested plugins is the selected option for this example.
The plugins will be installed, and you can only wait until the installation is finished. As you can see below, there are fourteen (14) suggested plugins being installed. The number of recommended plugins may increase or decrease over time. By the time you installed your Jenkins instance, the suggested plugins may already be different.
Immediately after the plugins’ installation finished, you will see the Create First Admin User page. This page is where you will create the first Jenkins administrator account. Fill in all the boxes as required and click on Save and Continue. Make sure to remember the administrator credential you have just created.
On the Instance Configuration page is where you can change the Jenkins admin page URL. The URL value would typically be the actual URL that will be accessed by the Jenkins users.
For this example, leave the default value of http://localhost:8080 and click on Save and Finish.
4. On the final setup page, you will see the confirmation that the Jenkins setup is complete. Click on Start using Jenkins.
When you see the Welcome to Jenkins page, as shown below, then you’ve completed the Jenkins installation. At this point, you can start configuring Jenkins and creating new items or projects.
Finding the Jenkins Data on the Docker Host
Where’s the Jenkins data folder now?
Based on the command you used to create the my-jenkins-2 container, the mounted volume is jenkins_home. To know where in the filesystem is the jenkins_home location can be found, use the docker volume command.
Now that you know where to find the Jenkins data, you can confirm by exploring the mount point location.
In this example, the jenkins_home volume mount point is in /var/lib/docker/volumes/jenkins_home/_data
Now that the Jenkins data persists outside of the container, you can backup the directory for safekeeping.
Also, even if the Jenkins container is deleted, the data will remain on the Docker host
Creating the Docker Compose Files
To start the jenkins-01 container, use the command below
Note: The command below assumes that the docker-compose.yml file is in the same directory where you run the command.
Note: If there is a firewall unblock port
Last updated