Continuous Delivery with Docker and Jenkins

280

Installing on Docker(Jenkins)

We need to specify the first host_port parameter—the port under which Jenkins is visible outside of the container. The second parameter, host_volume, specifies the directory where the Jenkins home is mapped. It needs to be specified as volume, and therefore persisted permanently, because it contains the configuration, pipeline builds, and logs.

As an example, let’s see what the installation steps would look like in case of the Docker host on Linux/Ubuntu.

  1. Prepare the volume directory: We need a separate directory with the admin ownership to keep the Jenkins home. Let’s prepare one with the following commands:

  1.  Run the Jenkins container: Let’s run the container as a daemon and give it a proper name:

  1.  Check if Jenkins is running: After a moment, we can check whether Jenkins has started correctly by printing the logs:

In the production environment, you may also want to set up the reverse proxy in order to hide the Jenkins infrastructure behind the proxy server. The short description how to do it using the Nginx server can be found at https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+with+Docker.

After performing these few steps, Jenkins is ready to use. The Docker-based installation has two major advantages:

  • Failure recovery: If Jenkins crashes, then it’s enough to run a new container with the same volume specified.
  • Custom images: You can configure Jenkins as per your needs and store it as the Jenkins image. Then it can be shared within your organization or team, and there is no need to repeat the same configuration steps all the time, many times.
SHARE
Previous articleNote about MongoDB 2019.02
Next articleReact Native