DevOps prep

Intent: Setup an Oracle Virtual box image with Jenkins, so that we can run all our examples of containerization on the same.

Step 1:

Install Oracle Virtual Box from https://www.virtualbox.org/wiki/Downloads

Step 2:

Download the docker-pre-installed Alpine Linux image from: http://tiny.cc/rwdockerclass

Step 3:

Double click on the downloaded .ova file so that it opens in VirtualBox and creates an image on the same.

Step 4:

Start the newly created image. Username is “root” and the password is “Pass@word1”

Step 5:

Once inside the Alpine OS, let’s install Firefox browser. Run the following command on a new terminal tab:

apk add firefox-esr

Step 6:

Let’s setup Jenkins as a docker container. Create a folder /var/jenkins_home and change the ownership to jenkins (user id 1000).

Following is from a github page issue:

This is the same as #155 and documented in README

This will store the jenkins data in /your/home on the host. Ensure that /your/home is accessible by the jenkins user in container (jenkins user – uid 1000) or use -u some_other_user parameter with docker run.

You must set the correct permissions in the host before you mount volumes sudo chown 1000 volume_dir

So, I issued the following command:

mkdir -p /var/jenkins_home

sudo chown 1000 /var/jenkins_home

Step 7.

Pull the latest Jenkins docker image and create/start the container.

docker pull jenkins/jenkins

docker run -d \
-p 8080:8080 \
-p 50000:50000 \
--name jenkins \
-v /var/jenkins_home:/var/jenkins_home \
jenkins/jenkins

Step 8:

Open http://localhost:8080 using the firefox browser. Follow the instructions and install the recommended plugins. In case if some of the plugins fail to install, retry and they should install just fine. After all the plugins are installed, you will be prompted to create a user account.

Step 9:

To stop the container (if needed), run the docker stop jenkins command. To start again, docker start jenkins should do. Please note that the word jenkins used here refers to the name (--name) used when we issued the docker run command in step 7.


Installing git on Alpine Linux

Open a new terminal and issue the following command:

apk add git

To verify if the installation is done successfully, type the command:

git --version

Installing Maven on Alpine Linux

Run the following command in a new terminal:

apk add maven

To verify the installation, execute the following command:

mvn --version