Quick start with jenkins in docker

Gustavo Apolinario
4 min readMar 9, 2018

--

What’s Jenkins? Jenkins is a automation tool. With him, you can create jobs to build, test and deploy your application.

You can create your pipelines in jenkins. But whats’s pipeline? Pipeline is a script step by step of all things you need to do. Example: you will create a pipeline to build your code. First step is checkout your git code, after this you need test, build, package, create a docker image and finaly, deploy your code.

For fist steps with jenkins, let’s create a container in your machine.

You need docker installed and running in your machine.

Execute this command:

docker run --name jenkinsci -p 8080:8080 jenkins/jenkins:lts

This command will download and run a jenkins in your machine.

Wait some time, The console will show a lot of messages. When jenkins was inicialized, the console will show you a admin password to start jenkins initial setup. The text with password is:

*************************************************************
*************************************************************
*************************************************************
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:
a3c76c0cc3e541ff94b3670c22995342
This may also be found at: /var/jenkins_home/secrets/initialAdminPassword
*************************************************************
*************************************************************
*************************************************************

You can access your jenkins in http://localhost:8080/. You will see this screen:

Put the admin password in input on the screen and press continue.

In next screen, click “Install suggested plugins”

Wait the plugns instalations

Now, create a user for you.

We finish the instalation, click “Get start using Jenkins”

Let’s install two plugins:

  • blueocean plugin to beautify your jenkins. This plugin better the usability of jenkins and focus in pipelines scripts.
  • locale plugin to jenkins always show english text. You don’t need install this, but i suggest install to search errors directly in english.

Go to Plugin Manager again and search for locale

To install plugins:
- In home of jenkins, click in Manage Jenkins:

Click in Manage Plugins:

In Plugin manager, you need click in Available tab and after load the tab, search the plugins

Search for locale, mark the checkbox and click in install button.

After install locale, go to Home > Manage Jenkins > Configure System

Search for locale. Input “en” in “Default language” and check “ignore browser preference and force this language to all users”

Locale Plugin installed and configured, lets install Blue ocean.
Back to jenkins home > Manage jenkins >Manage Plugins. In Available tab search for blueocean and install it.

All done. But you see the visual without blue ocean plugin, let’s use it.
In Jenkins home, Click in “Open Blue Ocean” (left menu)

Now, you will see a screen like this:

All Right, now we have jenkins installed and we are using blue ocean plugin to have a better experience in your pipelines.

The next steps is create a pipeline to build some things for us.

--

--

Gustavo Apolinario

I’m a FullStack Developer, working now with DevOps automations. I previously worked as a front-end, PHP Developer, and DevOps.