Monday, December 25, 2023

Docker Tutorial

 I have listed all the necessary commands of Docker below. In case if any is missing or if any improvement required, please share in comments so I can update accordingly. Thanks and enjoy tutorial.


 1) docker –verison

        display version command

2) docker version

3) docker image ls

          Display images which are downloaded or created.

4) docker image pull ubuntu:latest

        Above command pull image from docker hub.


5) docker container run -it ubuntu:latest /bin/bash

Above command launch and start image in container which is fetched in docker host from above command.


6) ps -elf (inside bash command)


7) Ctrl + PQ (Command exit from bash but keep it running)


8) docker container ls

Shows above container running. Also container names in last column called "NAMES"


9) docker container exec -ti <container-name>/<container-id> bash


10) docker container <container-name>/<container-id>


>>>>>>>>>>>DOCKER DEVELOPER <<<<<<<<<<<<<<<<<<<<<<<<<<<


11) Create folder and run command

git clone https://github.com/nigelpoulton/psweb.git


12) Goto into new folder created and run following command.

docker image build -t test:latest .


13) docker image ls


14) docker container run -d --name web1 -p 8080:8080 test:latest


15) docker container ls


16) docker container run --name zm -it ubuntu:latest sh

command generates id


17) docker rm <dockerid_generated_after_executing_command15>


18) Docker images can be found inside

/var/lib/docker/ on linux

and on windows inside c:\program data\docker\windowsfilter


19) docker image inspect ubuntu:latest


20) docker image ls --digests alpine


21) docker image rm alpine:latest

Above command Remove mentioned image e.g., remove alpine:latest


22) docker image pull alpine@sha26:a75afd8b57e7f34e4dad8d65e2c7ba2e1975c795ce1ee22fa34f8cf46f96a3be


Above command pull image of alpine using digest. Digest is a hashcode which is created from the contents of file itself. Advantage of it over Tag is that it will never be the same. Tag can be mistakenly same. For example you download image with the tag "latest" and also push/update them image on server (e.g., DockerHub) with same Tag mistakenly. This will not be possible with Digest as it uses file contents/image contents to create Hash and image will always be change if you made any change in it. Even a single word written in image will change Digest/hash code of image.


23) docker image ls -q

List all images IDs


24) docker image rm $(docker image ls -q) -f

OR

docker container rm $(docker container ls -aq) -f

1st command remove all images from Docker/your system. Second command will remove all containers from your system. The -f flag

forces the operation so that running containers will also be destroyed.


25) docker container run -it alpine:latest sleep 10

Hold above container for 10 seconds and then sleep/exit from process.


26) usermod -aG docker <user>

Above command will add any user you mentioned to docker group.


27) service docker status

and systemctl is-active docker

Above both commands check status of docker. 1st command will show some more details where as second command will only show its status.


28) docker container run --name myubuntu -it ubuntu:latest /bin/bash

Above command will start your container. Exit from shell of container using Ctrl+PQ without terminating the process. Please note that containter will be Alive till any of the process is running inside it. Once no process is alive, container will be terminated itself.

To reconnect with the same process, you need to know container image id. Type following command.

docker container ls -q

This command will provide your 12 characters of container image id (e.g., 36aa4eb7a789).

To reconnect to the image, use below command.

docker container exec -it 36aa4eb7a789 bash


29) docker container run -d --name webserver -p 80:8080 \

nigelpoulton/pluralsight-docker-ci

Above command will download image of pluralSight from nigelpoulton dockerHUB Account nigelpoulton/pluralsight-docker-ci. It will also

detach process and start web server on 8080 port.

"d" stands for daemon mode.

-it and -d are mutually exlcusive modes/commands and can not be used together for starting a container.

30) docker image history web:latest

Display commands history executed on particular image.


Identifying Docker Container IP

  Dear Folks, Today I am going to share how we can identify Docker Container IP. We can identify docker container IP use following commands. Please note that docker IPs start with subnet 172.17.*.*


1) Following command will provide all docker running process with ID/Status/Names.

docker ps --format \
"table {{.ID}}\t{{.Status}}\t{{.Names}}"



2) To identify specific docker container IPAddress use following command. Please  note docker container id IP which I am going to see has docker container id  "2a869b54036f" . ID of the container returned from Step 1.

 
docker inspect -f \
'{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' \
2a869b54036f


5) To run docker container on specific port, you can use following command docker run -d --name hsm -p 1500:1500  hsm:latest


I hope above article will assist you in learning docker efficiently. Please provide your reviews in case if it helps you to increase its authencity.

DECOMPILING IIB BAR FILE TO IIB PROJECT

 Dear Readers,


Since I started IBM IIB ACE 12 development, one of the questions in my mind was that how to decompile IIB Project from its Bar file (for example like decompiling DLL in .NET). Today I am sharing that how can we achieve it by following below steps.


1) Create an IIB Project with the same name which is reflected in side your bar file. for example, APP_Demo.

2) Now, right click on that project, go to "Properties" and see where is it located. Browse that folder.

3) Once completing Step2, goto Bar file and extract it and copy all folders from that to the location of Step 2.

4) Recompile the project to see if any error appears and do the same for any library (if shows missing).

By following above 4 steps, you have successfully decompiled BAR file. HURRAY !!! 


As always wrote, please leave your comments to reflect authenticity of this article. 


Tuesday, September 10, 2019

Cannot Find The Tag Library Descriptor For “http://java.sun.com/jsp/jstl/core”

Error:

Cannot Find The Tag Library Descriptor For “http://java.sun.com/jsp/jstl/core”

Dear Folks,

you might face above error for two reasons.

1) Your Servlet Container does not support JSTL.

2) You did not configure configure your Servlet Container.

 

To resolve the issue either download JSTL jar and place it on desired location or the most easiest way is to download Apache TomEE server which supports JSTL and many other e.g., JMS, etc.

 

After installation, configure it in your IDE or make a package .war and deploy it on server and run your application.

 

I hope above post will help you in resolving your issue. If it helps then please do comment.

 

Thanks.

Monday, September 9, 2019

Spring Boot: Apache Cataline Could not load resource factory class

Error Message:
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener createMBeans
SEVERE: Exception processing global JNDI Resources
javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]



Answer:

While running Spring Boot Project, spring project was unable to start due to above error. After doing some research, I identified that this is due to corrupt installation of Apache Tomcat Server.

Steps to resolve :

1) Download Apache Tomcat Server.
2) Open Eclipse, add apache server again from "Servers" Tab.
3) Run Project.

Hopefully above post will resolve subjected issue. In case if this helps you then please do comment to increase validity of post.

Thanks.


Thursday, August 29, 2019

CREATING SHORTCUT ICON TO DISPLAY IN LINUX MENU

Dear Folks,

Today, I am going to describe how to create / bring icon in Linux Menu so instead of going to folder and running .sh (shell extension) file from there, you can simply call it from menu. Please follow below steps.

1) You must be on your home folder path. Mine is
/home/zeeshan/

2) Browse .local/share/applications.  (Please note you might not view .local folder until you set "Show All Hidden Files and Folders")

3) Create WebStorm.desktop file and inside file write below content (Please set path in Icon and Exec according to your installation)

[Desktop Entry]
Type=Application
Name=WebStorm
Comment=WebStorm Development
Icon=/home/zeeshan/Softwares/WebStorm-192.6262.59/bin/webstorm.svg
Exec=/home/zeeshan/Softwares/WebStorm-192.6262.59/bin/webstorm.sh
Terminal=false
Categories=Development;IDE;
StartupWMClass=WebStorm


4) Save WebStorm.desktop file and now you can simply browse it from your menu.

Please post your comments below in case if above post help you.

Thanks.




Saturday, September 22, 2018

Compile and Run Java Program From Sublime Text 3


Dear All,

Today, I am going to write about how you can compile and run your Java program from Sublime Text.

First, you need to set a Build System. To achieve it, follow below steps:
1) Goto Tools -> Build System  -> New Build System
2) A editor tab will open. Remove all predefined code and paste below code

{
    "shell_cmd": "javac $file_name && java $file_base_name",
    "working_dir": "${project_path:${folder}}",
    "selector": "source.java"
}

After pasting above code, save file with Java.sublime-build under sublime-text-3/Packages/User/.

Now, Goto Tools -> Build System and select Java (you will see new build after following above steps).

Now press Ctrl+B and enjoy the result. Please note that Ctrl+B is used to Build your program.

Enjoy coding with this lightweight software. Do comment if above post helps you.

Thanks.

Sunday, July 15, 2018

Difference Between Apache Common Logging and Log4J

Dear Folks,

Log4j is a logging framework, i.e. it provides the code to log messages while Commons-logging is an abstraction layer for logging frameworks, it doesn't log anything itself. For example if I write code using commons logging and deploy it on JBoss, the logging is done by log4j, but if I deploy it on WebSphere logging is done by WebSphere's own logging implementation. If I run the same code as a stand alone application it Java's own logging that is used.

Hope this help you in understanding the difference between two. 

Sunday, June 4, 2017

WRITE PERMISSION ON SAMBA DRIVE ON LINUX

Dear Readers,

You can find various post on installing SAMBA on Linux. In my post, I am sharing you the method through which you can allow windows users to write / copy data on your LINUX based drive.

Please remember that before that you have to create a user whom you can provide rights to copy data on Linux machine. User name should be common on Windows and LINUX.

Now, time to start real thing. Open your smb.config file (located in /etc/samba/ on LINUX drive)

[windowsSharing]
   comment = File sharing path for windows
   path = /home/user/abc/  [path which you want to share]
   writeable = yes
   browseable = yes
   public = yes
   guest ok = yes
   force user = your_user_name

Now save your file and run following command

sudo service smbd restart

After restart of service, you will be able to share your files between linux and windows.

If this post helps you then please leave a comment to increase its reliability. Also comments are welcomed to improve this post (if any).





Tuesday, July 26, 2016

Could not get lock /var/lib/dpkg/lock

Today, I tried to install Git on my Ubuntu machine and during that I received following exception related to locking. In my this post, I have shared all commands and error messages with you.


Command
sudo apt-get install git

Error Message
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?



After searching above message, I found a command

sudo lsof /var/lib/dpkg/lock

after pressing ENTER, it might asked you for password. Type the password and in result you might get following output

lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
unattende        1468 root    5uW  REG    8,1        0 154817 /var/lib/dpkg/lock

Type following command to kill the session with provided PID by your system. In my case PID # was 1468. I use following command to kill this process id.

sudo kill 1468

After execution of above statement, now I was able to download GIT by using following command again which I executed in start.

sudo apt-get install git

In case if this article helps you then please leave a comment to increase its credibility.

Thanks.

Sunday, July 24, 2016

NodeJS Series: Calling Sleep Method.

Dear Friends,

This is my first article about NodeJS, I am currently exploring it and problems which I found during my learning sessions, I will share it to you with my blog posts.

Today while writing some code, I come across the need of sleep functionality between two transactions. While doing google, I found "sleep" library which provide required functionality.

Calling of sleep method is simple e.g.,

sleep.sleep(1) // time will be defined in seconds 

But before that you need sleep library / package. To download it, use following npm command

npm install sleep

After successful installation, write following code to test this functionality.

var sleep = require('sleep');

function callLoops()
{
for(var a=1;a<10;a++)
{
console.log('%d',a);
sleep.sleep(1); //times in seconds.
}
}

callLoops();

and save this code in myExample.js file.

Execute the file with following command

node myExample.js

Congratulations...... You have achieved the goal.

That's all for now folks..... If this post help you then please increase its credibility by posting your comments.

Thanks.

Monday, March 14, 2016

HOW TO USE SPRINGFORM:ERROR TAG

To use Spring Form Error Tag, you have to follow following steps.

Your JSP Page should look like this:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>About Us Page</title>
    </head>
    <body>      
        <sf:form method="POST" action ="/SpringBasics/redirect.aspx" modelAttribute="basicClass">
            FirstName: <sf:input path="firstName" />
            <sf:errors path="firstName" />
        <br/>
            <input type="submit" value="Redirect Page" />    
        </sf:form>
    </body>
</html>


Tuesday, February 9, 2016

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'xxx' available as request attribute

While trying to use Spring MVC form Tags, I come across following exception


java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'userInput' available as request attribute

Below is my JSP Code with Spring Tags

<%@page contentType="text/html" pageEncoding="UTF-8" session="false" %>
<%@taglib uri="http://www.springframework.org/tags" prefix="st"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="sf"%>
<!DOCTYPE html>
<html>
    
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>About Us Page</title>        
        <st:url var="bootstrapp_theme" value="/resources/css/bootstrap-theme.css" />
        <st:url var="bootstrapp_css" value="/resources/css/bootstrap.css" />
        <st:url var="jquery" value="/resources/js/jquery-2.2.0.js" />
        <st:url var="bootstrapp_js" value="/resources/js/bootstrap.js" />
        <link href="${bootstrapp_theme}" rel="stylesheet" />
        <link href="${bootstrapp_css}" rel="stylesheet" />        
        <script src="${jquery}" ></script>
        <script src="${bootstrapp_js}" ></script>
        
        
    <body>
        <h1 class="text-center">ABC CORPORATION</h1>
        
        <sf:form method="POST" action ="/SpringBasics/redirect">
            
            <table>
                <tr>
                
                    <td>Login ID: &nbsp;&nbsp;<input type="text" name="userName" />
                       <br> Email: &nbsp;&nbsp;<sf:input type="email" path="email" />
                       <br> My Label: &nbsp;&nbsp;<sf:label id="lbl1" path="myLabel"   />
                         
                    </td>
                </tr>
                <tr>
                    
                    <td>Password:&nbsp;&nbsp;<input type="number"  name="extension" /></td>
                </tr>
            </table>


            <input type="submit" value="Redirect Page" />
        </sf:form>
    </body>
</html>


To  resolve it I created a properties class which is defined below


package springbasics;



/**
 *
 * @author Zeeshan
 */

public class userInput {

    protected String _email;

    protected String _myLabel;

    public String getMyLabel() {
        return _myLabel;
    }

    public void setMyLabel(String _myLabel) {
        this._myLabel = _myLabel;
    }

    public String getEmail() {
        return _email;
    }

    public void setEmail(String _email) {
        this._email = _email;
    }


}

and change my JSP Code from 
        
<sf:form method="POST" action ="/SpringBasics/redirect">

To

<sf:form method="POST" action ="/SpringBasics/redirect" modelAttribute="userInput" >


Also change my controller class parameter From 

@RequestMapping(value = "/", method = GET)
    public String aboutUs() {     
        return "aboutus";      
    }

To

@RequestMapping(value = "/", method = GET)
    public String aboutUs(userInput obj) {     
        return "aboutus";      
    }


This resolve the above error message. 

If suggested solution help you in solving your issue then please comment to increase its credibility.

Thanks.


Thursday, January 28, 2016

SCRIPT AUTOMATICALLY EXECUTE ON CONSOLE OPENING

Dear Linux Lovers,

If you want to load a shell script automatically whenever console is opened by user then right it in " .bashrc " file. The file exists in user home directory. To edit .bashrc simply write


vi .bashrc   /*To open in VI*/

or any other editor which you love.

Enjoy Linux World.

No Launcher Load in Ubuntu





Sometimes UBUNTU does not show launcher due to some problem and in that case we have to re-install the O/S again. I come across this problem several times but today I did some research and found this easiest solution which work for me and I hope that It will work for you as well.

Follow below steps to get your UBUNTU launcher back:

1) Press CTRL+ALT+DTL in vm ware (3 Buttons combine) to open your processes window inside Virtual Machine.

2) Go to 3rd Tab (Disk) and double click on /dev/sda1. This will open your Files Explorer.

3) Now press CTRL+F for searching and find TERMINAL.

4) Open TERMINAL.

5) Write " sudo apt-get update "

6) Write " sudo apt-get install unity " to install Unity which will display you LAUNCHER.

7) Write " sudo reboot " to reboot your Virtual Machine.


After your computer / Virtual Machine is reboot, you can see your LAUNCHER back.

Above steps resolve my problem and if does the same in your case then please comment so the reliability of the post will increase.

Thanks.



Sunday, January 17, 2016

Unable to run mksdcard SDK tool.

During configuration of Android IntelliJ on UBUNTU, you might come across subjected message. Following command will help you in resolving this issue.

sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6
 
 
 

HOW TO REMOVE ALL JDK FROM UBUNTU

Following command will remove all JDK versions from your computer in UBUNTU

 sudo apt-get purge openjdk-*

In case if above code help you then please leave a comment for its authenticity to others.


Sunday, December 27, 2015

PASSING SUMMARIZED VALUES FROM SUB-REPORT TO MAIN-REPORT IN CRYSTAL REPORTS

Dear All, this time what I am going to share with you is passing summarized variables from sub-reports to main-reports in crystal reports. Here, we have different ways to pass summarized fields from sub-report to main-report and vice-versa but what I am going to share with you is quite simple and easy as well.

Below I am describing the steps through which you can perform this task.
  1. Just create a new Crystal report and call it “mainpage.rpt”.
  2. Now add formula field and name it what you like. I am giving it name “mainTotal”
  3. Edit “mainTotal” formula field and write in it shared numbervar x; [note:  you can take any type like Boolean , etc.]
  4. Now, add a sub-report in main report and also create a formula fields.[Repeat step 2 and 3]
  5. Now switch to main report again.
  6. Right click on sub-report. You will see in menu option “Change Subreport Links”. Click on it.
  7. Bring that “mainTotal” field in “fields to link”  and uncheck checkbox having “Select data in subrport based on field”.
  8. Press OK Button.

Hey All………. Congrates. You have created your first report that is able to share values between main report and sub-report.

Kindly see below image where to keep sub-report and summarized variable so that if you are receiving value of previous section not current section then you can make necessary changes and get the correct one report.




If above post help you then please leave a comment.


Sunday, October 4, 2015

ENABLE ROOT USER IN LINUX

Root user is super user in linux operating system. In ubuntu, it is not enabled by default. To Enable "root" user in linux, follow below commands.

First Change the password of root by executing below command

sudo passwd root
 
This will ask you enter password. After configuring the password, unlock root user by following command.

sudo passwd -u root 
 
In case if above solution works for you then kindly leave a comment for ensuring the credibility of the solution.

Thanks.



Configuring Java Delopment Kit in LINUX

One of the important topic for beginners in linux operation system is the steps of configuring JDK (Java Development Kit). Below are the steps which helped me and I hope that they will do the same in your case also.

Execute below commands by replacing the statements in bold format. Run these commands after logging in super user.

update-alternatives --install /usr/bin/java java /home/zeeshan/Downloads/jdk1.8.0_60/bin/java 100

update-alternatives --install /usr/bin/javac javac /home/zeeshan/Downloads/jdk1.8.0_60/bin/javac 100


To Remove Configuration of JDK use following commands

 sudo update-alternatives --remove java home/zeeshan/Downloads/jdk1.8.0_60/bin/java

 sudo update-alternatives --remove javac home/zeeshan/Downloads/jdk1.8.0_60/bin/javac

In case if above solution help you then please leave a comment for maximizing credibility of defined solution.

Thanks.

Docker Tutorial

 I have listed all the necessary commands of Docker below. In case if any is missing or if any improvement required, please share in comment...