Intent: Setup an Oracle Virtual box image with Jenkins, so that we can run all our examples of containerization on the same.
Install Oracle Virtual Box from https://www.virtualbox.org/wiki/Downloads
Download the docker-pre-installed Alpine Linux image from: http://tiny.cc/rwdockerclass
Double click on the downloaded .ova file so that it opens in VirtualBox and creates an image on the same.
Start the newly created image. Username is “root” and the password is “Pass@word1”
Once inside the Alpine OS, let’s install Firefox browser. Run the following command on a new terminal tab:
apk add firefox-esr
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
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 \
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.
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:
Installing Maven on Alpine Linux
Run the following command in a new terminal:
apk add maven
To verify the installation, execute the following command: