Jenkins setup from Docker Kitematic

Objective:
The objective of this article to understand how to setup Jenkins container from the Docker Kitematic dashboard. This will also give you an overview of how can we create, start, stop and delete any containers from Docker Kitematic.

Details:
Jenkins is one of the tools which is most commonly using across the IT industry as part of the project CI/CD process. CI/CD stands for Continuous Integration / Continuous Deployment. The main agenda of this post to make you understand how easy of installing the Jenkins container by using Docker Kitematic.

As we already explained in the previous post, Docker Kitematic is a Graphical tool to manage different docker containers that exist in Docker. So as part of this post, we will not use any Command Line Interface(CLI).

Prior to the continuation of this article, make sure you have installed Kitematic in Docker. If you have not installed, follow the steps which are explained in Docker Kitematic installation in Windows 10.

Create a Container:
Step 1: The above diagram represents the official Jenkins Docker image in the Docker Kitematic dashboard along with other images like ghost, Redis, Solr, elasticsearch, etc. Click on the CREATE button to download the Jenkins docker image.
If we need to pull the Jenkins docker image from DockerHub, we need to use the below command, but as part of Kitematic, we are not executing any of the commands explicitly.

docker pull jenkins

Start Container:
Step 2: You will be shown the download progress page, let’s wait until the download completes. And it automatically starts the Container as on when the download completes. You can observe the Jenkins container startup logs in below,

Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
 Oct 08, 2019 6:00:56 PM Main deleteWinstoneTempContents
WARNING: Failed to delete the temporary Winstone file /tmp/winstone/jenkins.war
 Oct 08, 2019 6:00:57 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Logging initialized @3721ms
Oct 08, 2019 6:00:57 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
 Oct 08, 2019 6:01:03 PM org.eclipse.jetty.util.log.JavaUtilLog warn
WARNING: Empty contextPath
 Oct 08, 2019 6:01:03 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: jetty-9.2.z-SNAPSHOT
Oct 08, 2019 6:01:07 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
Oct 08, 2019 6:01:10 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Started w.@47404bea{/,file:/var/jenkins_home/war/,AVAILABLE}{/var/jenkins_home/war}
Oct 08, 2019 6:01:11 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Started ServerConnector@1c80e49b{HTTP/1.1}{0.0.0.0:8080}
Oct 08, 2019 6:01:11 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Started @17405ms
Oct 08, 2019 6:01:11 PM winstone.Logger logInternal
INFO: Winstone Servlet Engine v2.0 running: controlPort=disabled
Oct 08, 2019 6:01:14 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization
Oct 08, 2019 6:01:14 PM jenkins.InitReactorRunner$1 onAttained
INFO: Listed all plugins
Oct 08, 2019 6:01:22 PM jenkins.InitReactorRunner$1 onAttained
INFO: Prepared all plugins
Oct 08, 2019 6:01:22 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started all plugins
Oct 08, 2019 6:01:22 PM jenkins.InitReactorRunner$1 onAttained
INFO: Augmented all extensions
Oct 08, 2019 6:01:28 PM jenkins.InitReactorRunner$1 onAttained
INFO: Loaded all jobs
Oct 08, 2019 6:01:29 PM hudson.model.AsyncPeriodicWork$1 run
INFO: Started Download metadata
Oct 08, 2019 6:01:29 PM jenkins.util.groovy.GroovyHookScript execute
INFO: Executing /var/jenkins_home/init.groovy.d/tcp-slave-agent-port.groovy
Oct 08, 2019 6:01:31 PM jenkins.InitReactorRunner$1 onAttained
INFO: Completed initialization
Oct 08, 2019 6:01:32 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@4b266244: display name [Root WebApplicationContext]; startup date [Tue Oct 08 18:01:32 UTC 2019]; root of context hierarchy
Oct 08, 2019 6:01:32 PM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@4b266244]: org.springframework.beans.factory.support.DefaultListableBeanFactory@6362a49e
Oct 08, 2019 6:01:32 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6362a49e: defining beans [authenticationManager]; root of factory hierarchy
Oct 08, 2019 6:01:34 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@6d93e090: display name [Root WebApplicationContext]; startup date [Tue Oct 08 18:01:34 UTC 2019]; root of context hierarchy
Oct 08, 2019 6:01:34 PM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@6d93e090]: org.springframework.beans.factory.support.DefaultListableBeanFactory@7a6e32a5
Oct 08, 2019 6:01:34 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7a6e32a5: defining beans [filter,legacy]; root of factory hierarchy
Oct 08, 2019 6:01:35 PM jenkins.install.SetupWizard init
INFO: 

*************************************************************
*************************************************************
*************************************************************

Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

6ad6a1bd484844a690881ad01a1b8878

This may also be found at: /var/jenkins_home/secrets/initialAdminPassword

*************************************************************
*************************************************************
*************************************************************

--> setting agent port for jnlp
--> setting agent port for jnlp... done
Oct 08, 2019 6:01:50 PM hudson.model.UpdateSite updateData
INFO: Obtained the latest update center data file for UpdateSource default
Oct 08, 2019 6:01:51 PM hudson.model.DownloadService$Downloadable load
INFO: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller
Oct 08, 2019 6:01:56 PM hudson.model.DownloadService$Downloadable load
INFO: Obtained the updated data file for hudson.tools.JDKInstaller
Oct 08, 2019 6:01:56 PM hudson.model.AsyncPeriodicWork$1 run
INFO: Finished Download metadata. 27,079 ms
Oct 08, 2019 6:01:58 PM hudson.model.UpdateSite updateData
INFO: Obtained the latest update center data file for UpdateSource default
Oct 08, 2019 6:01:58 PM hudson.WebAppMain$3 run
INFO: Jenkins is fully up and running

As per the above logs, we can understand, downloading Jenkins metadata is finished and Jenkins is fully up and running. We can also observe that from the highlighted lines, Jenkins is created the admin user to access and do the initial setup of Jenkins with the encrypted password.

Below is the normal command which we will use to run the docker container. In this case, we are using the Jenkins image to run as a container in Docker.

docker run -it -p 8080:8080 Jenkins

How can I access Jenkins?
By default, Docker Jenkins will use 8080(Not exposed) port so make sure there are no other processes are using the same port. We can’t directly access the Jenkins with the port of 8080 when we are running from Docker Kitematic. This 8080 port is internally mapped to some other host:port which is exposed to the outside world. We can find that information under the Settings ==> Hostname/Port as shown in the below image,

As on when we hit the localhost:32779 from any of the browsers, we can see the below screen.

What is the default Jenkins admin password?
There are 2 ways to find the password.
1. You can find it from the Jenkins Container startup logs as shown in the above.
2. Click on /var/jenkins_home under the Volumes to extract the war file content. You can also find the password from the below path after volume(war) extraction completes.

C:\Users\USER\Documents\Kitematic\jenkins\var\jenkins_home\secrets\initialAdminPassword 

Jenkins Customization page:
As on when we successfully authenticated, we will be shown a page called Jenkins Customization page. Look at the below snapshot,

As on when I choose the Install Suggested plugins option from the above screen, Jenkins started installing the plugins. Please look at the plugin installation progress as shown in the below image,

If in case you get a message of saying some of the plugins are failed to install, do you want to retry or continue? better retry once or twice. If still you will be shown the same message, just ignore and choose the link of Continue.
Create First Admin User:

Click on Continue as admin link from the above screen you will be shown the below screen.

Click on Start using Jenkins to see the Jenkins home page.

Now your Jenkins setup is done successfully. You can create new jobs to configure CI/CD process for your project.

How to Stop, Restart running containers in Kitematic?
Stopping or restarting the running docker container is an easy process from Docker Kitematic. As shown in the below image, please click on Stop/Restart button accordingly to process the same.

How to delete the Docker container from Kitematic?
As shown in the below image, you can find the DELETE CONTAINER button under the SETTINGS tab to delete any of the containers from Docker Kitematic.

I hope this will be clear. Thanks for VISITING. Happy Learning…. 🙂

Advertisements
Advertisements

Docker Kitematic installation

Objective:

The objective of this article to understand Docker Kitematic. Kitematic is a graphical tool that will help to manage docker containers without using Command Line Interface (CLI).
Details:
Docker Kitematic will play major role in Docker administrator work as part of the download, run and administer Docker Containers. Since this tool provides UI to maintain Docker containers, there is no need for using Command Line Interface.
Installation:
Docker Kitematic installation is very easy to do in Windows. Follow the below steps to install Docker Kitematic in your system.
Step 1: Make sure your docker is running. And right-click on the docker icon symbol to choose the Kitematic option. Look at the below image for reference.
Step 2: As on when we click on Kitematic as shown in the above image, it will point to an alert box with the Download button along with the path where do we need to extract Kitematic files into. Look at the below snapshot.

C:\Program Files\Docker\Kitematic

Note: If you have installed your docker other than C:\Program Files, you can place Kitematic unzipped directory under the path of docker installed.
Step 3: Now repeat the first step again, it should take you to the Kitematic login/dashboard page. If you have any problem with starting Kitematic, just restart the docker once and repeat the same.
Note: As shown in the below image, you may get the problem while starting the Kitematic. If you are getting a similar screen, that means you are trying to start Kitematic before Docker getting started. Please wait until Docker is getting started and then try to start Kitematic.

Kitematic Login Page: Kitematic also uses the same Docker login credentials. If you already logged into Docker, this step may not be shown to you and it can take you directly into the Kitematic dashboard which shown in the next image.

Kitematic Dashboard:

Docker Kitematic installation is successfully completed. Thanks for visiting. Happy Learning…. 🙂

Build problems with Windows Containers in Docker

The objective of this article to explain, different problems that we can face when we choose to use Windows containers instead of Linux containers while installing the Docker.

Problem 1:

C:\Users\doodle\cheers2019> docker build -t subbareddyroyal/cheers2019 .

error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/build? buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0 &cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0 &memswap=0&networkmode=default&rm=1 &session=5mkq4eaqhltzh42vectdfwvtq&shmsize=0 &t=subbareddyroyal%2Fcheers2019 &target=&ulimits=null&version=1: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be
run elevated to connect. This error may also indicate that the docker daemon is not running.

The reason why I was getting that error is, Docker engine was not started. So, make sure you have started the Docker Desktop before running the above build command.

Problem 2:

no matching manifest for windows/amd64 10.0.17134 in the manifest list entries

To solve the above problem, right-click on Docker and choose Settings. Go to Daemon and enable the Experimental feature then click on the Apply button. Docker will automatically restart. Look at the below snapshot. Then again try to run the build command.

Otherwise, you can also add –experimental to the above build command. But, passing this parameter is temporary and it may cause the issue in the future as well. So, I would like to suggest to follow the above enabling Experimental feature option.

If still, you face a similar issue while building, you can pull the amd64 specific files by issuing the below command.

docker pull mcr.microsoft.com/windows/nanoserver:1803-amd64

Restart the Docker and then issue the same above doodle build command to build.

If still your problem is not solved with the above solution, Switch docker containers from Windows to Linux. Look at the below snapshot,

You will be alerted with the below and alert message, look like below. Click on the Switch button to proceed further. This may take several minutes to complete.

Then issue the same build command to build the project. For me, Switch to Linux containers helped and build the project successfully.