Jenkins is one of the leading open-source automation servers and has been adopted by top industries around the globe to automate and deliver their software to market securely and in record times. It has a huge community that supports and provides hundreds of integrations and plugins that can be utilized to develop and build out your CICD pipelines. Let's have a look at how we can setup Jenkins CI with Docker:
Docker Compose Config And Jenkins Setup
The first is going to be to create our docker-compose YAML file and copy the code below:
version: "3.8" services: jenkins: image: jenkins/jenkins:lts restart: always privileged: true user: root ports: - 5000:8080 - 50000:50000 container_name: jenkins volumes: - /docker/jenkins:/var/jenkins_home - /var/run/docker.sock:/var/run/docker.sock
Once you created the docker-compose yaml run
docker-compose up -d to set up Jenkins. After the setup is completed navigate to
http://<docker_host_ip>:5000 and it will prompt you for the administrator password like in the image below. If you have Portainer set up you can view the docker logs of your Jenkins service there otherwise run
docker logs jenkins to view and copy the administrator password to continue with the setup.
The next step is to select the plugins you want to install. For this exercise we selected suggested plugins, alternative plugins can always be installed at a later stage. The installation of suggested plugins will install and once complete you will be able to create your login credentials and login to the Jenkins dashboard and start scripting and building out CI/CD pipelines and workflows.
In conclusion, Jenkins is a great tool for scripting and building CICD pipelines and workflows. It is reliable and has a huge support community with many plugins and integrations. If you enjoyed this article consider signing up for our newsletter and don't forget to share it with people that would find it useful. Leave a comment below with a tutorial you would like us to cover.