<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Rishav's blogs]]></title><description><![CDATA[Rishav's blogs]]></description><link>https://techwithrishav.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 13 Oct 2026 14:32:13 GMT</lastBuildDate><atom:link href="https://techwithrishav.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Docker Project: Deploy a Java application in Docker Container]]></title><description><![CDATA[In this Docker project, you will learn how to containerize a Java application, making it easy to package, deploy, and scale your application within isolated environments. Docker is a popular platform for containerization, allowing you to create light...]]></description><link>https://techwithrishav.hashnode.dev/docker-project-deploy-a-java-application-in-docker-container</link><guid isPermaLink="true">https://techwithrishav.hashnode.dev/docker-project-deploy-a-java-application-in-docker-container</guid><category><![CDATA[Docker]]></category><category><![CDATA[docker images]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Azure]]></category><category><![CDATA[Microsoft]]></category><dc:creator><![CDATA[Rishav Kuchiya]]></dc:creator><pubDate>Fri, 10 Nov 2023 06:04:31 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1699596167692/9d07f244-eff2-4b80-8ce6-e8e903d3fe55.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-in-this-docker-project-you-will-learn-how-to-containerize-a-java-application-making-it-easy-to-package-deploy-and-scale-your-application-within-isolated-environments-docker-is-a-popular-platform-for-containerization-allowing-you-to-create-lightweight-portable-and-self-sufficient-containers-that-encapsulate-your-application-and-its-dependencies">In this Docker project, you will learn how to containerize a Java application, making it easy to package, deploy, and scale your application within isolated environments. Docker is a popular platform for containerization, allowing you to create lightweight, portable, and self-sufficient containers that encapsulate your application and its dependencies.</h3>
<ol>
<li><h3 id="heading-creation-of-azure-virtual-machine">Creation of Azure Virtual Machine :</h3>
</li>
</ol>
<p>/Creating a Linux virtual machine (VM) in Microsoft Azure involves several steps. Below is a step-by-step guide to creating a Linux VM in Azure:</p>
<ol>
<li><p><strong>Sign in to the Azure Portal</strong>: Log in to your Azure account using your credentials. If you don't have an Azure account, you can sign up for one.</p>
</li>
<li><p><strong>Navigate to the Azure Dashboard</strong>: After signing in, you'll be on the Azure Dashboard. You can access resources and services from this portal.</p>
</li>
<li><p><strong>Click on "Create a Resource"</strong>: On the Azure Dashboard, click the "Create a resource" button on the left-hand side.</p>
</li>
<li><p><strong>Search for "Virtual Machine"</strong>: In the search bar, type "Virtual Machine" and press Enter.</p>
</li>
<li><p><strong>Select "Virtual Machine"</strong>: From the search results, select "Virtual Machine" under the "Compute" category.</p>
</li>
<li><p><strong>Click "Create"</strong>: You'll be taken to the Virtual Machine creation page. Click the "Create" button to start the VM creation process.</p>
</li>
<li><p><strong>Basics</strong>:</p>
<ul>
<li><p><strong>Project Details</strong>: Select your Azure subscription and create or use an existing Resource Group.</p>
</li>
<li><p><strong>Instance Details</strong>: Provide a unique virtual machine name, choose a region, and availability options.</p>
</li>
<li><p><strong>Image</strong>: Choose your preferred Linux distribution (e.g., Ubuntu, CentOS, Debian, etc.).</p>
</li>
<li><p><strong>Size</strong>: Select a virtual machine size based on your requirements.</p>
</li>
</ul>
</li>
<li><p><strong>Administrator Account</strong>:</p>
<ul>
<li><p><strong>Authentication Type</strong>: Choose SSH public key or password. Using SSH key pairs is more secure.</p>
</li>
<li><p><strong>Username</strong>: Enter the username for the administrator account.</p>
</li>
<li><p><strong>Password/SSH public key</strong>: Provide the password or SSH public key based on your authentication type.</p>
</li>
</ul>
</li>
<li><p><strong>Inbound Port Rules</strong>:</p>
<ul>
<li><strong>Public inbound ports</strong>: Select which ports you want to open. For SSH access, allow port 22.</li>
</ul>
</li>
<li><p><strong>Disks</strong>: Configure the OS disk options. The default settings are usually sufficient, but you can customize them if needed.</p>
</li>
<li><p><strong>Networking</strong>: Configure virtual network settings, such as the Virtual Network, Subnet, Public IP, and Network Security Group.</p>
</li>
<li><p><strong>Management</strong>: Configure management settings, such as auto-shutdown, backup, and diagnostics.</p>
</li>
<li><p><strong>Advanced</strong> (Optional): You can configure optional features such as boot diagnostics and guest OS diagnostics.</p>
</li>
<li><p><strong>Tags</strong> (Optional): Add tags to help organize your resources.</p>
</li>
<li><p><strong>Review + Create</strong>: Review the settings you've configured, and click "Create" when you're ready to proceed. Azure will validate the settings.</p>
</li>
<li><p><strong>Deployment</strong>: Azure will start deploying your Linux VM. You can monitor the progress on the Azure Portal.</p>
</li>
<li><p><strong>Access the Linux VM</strong>: Open the Command prompt To access your Linux VM, use the <code>ssh</code> command. Replace <code>&lt;username&gt;</code> with the username you specified during VM creation, and <code>&lt;public-ip&gt;</code> with the public IP address of your Azure VM.</p>
<pre><code class="lang-plaintext">ssh &lt;username&gt;@&lt;public-ip&gt;
</code></pre>
</li>
</ol>
<p>That's it! You've successfully created a Linux virtual machine in Microsoft Azure. You can now install software, configure services, and use your VM as needed.</p>
<ol>
<li><h3 id="heading-installation-of-docker-in-linux-vm">Installation of Docker in Linux VM</h3>
</li>
</ol>
<p>To install Docker on a Linux virtual machine (VM), you can follow these general steps. The specific commands may vary depending on the Linux distribution you're using, but I'll provide instructions for a typical distribution like Ubuntu. If you're using a different distribution, consult your distribution's package manager or official documentation.</p>
<p>Here are the steps to install Docker on a Linux VM:</p>
<ol>
<li><p><strong>Access Your Linux VM</strong>: Log in to your Linux VM using SSH as explained in a previous response.</p>
</li>
<li><p><strong>Update the Package Repository</strong>: It's a good practice to update your system's package repository and upgrade installed packages before installing new software:</p>
<pre><code class="lang-plaintext"> sudo apt update
 sudo apt upgrade
</code></pre>
</li>
<li><p><strong>Install Required Dependencies</strong>: You'll need some prerequisites for Docker to work correctly. Install them by running the following commands:</p>
<pre><code class="lang-plaintext"> sudo apt install apt-transport-https ca-certificates curl software-properties-common
</code></pre>
</li>
<li><p><strong>Add the Docker Repository</strong>: To get the latest version of Docker, you should add the Docker repository:</p>
<pre><code class="lang-plaintext"> curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
</code></pre>
<pre><code class="lang-plaintext"> echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list &gt; /dev/null
</code></pre>
<p> Replace "Ubuntu" with your specific Linux distribution if you're not using Ubuntu.</p>
</li>
<li><p><strong>Install Docker</strong>: Now, you can install Docker:</p>
<pre><code class="lang-plaintext"> sudo apt update
 sudo apt install docker-ce docker-ce-cli containerd.io
</code></pre>
</li>
<li><p><strong>Start and Enable Docker</strong>: Start the Docker service and enable it to start on boot:</p>
<pre><code class="lang-plaintext"> sudo systemctl start docker
 sudo systemctl enable docker
</code></pre>
</li>
<li><p><strong>Verify Docker Installation</strong>: You can check if Docker is installed and running by running the following command:</p>
<pre><code class="lang-plaintext"> sudo docker --version
</code></pre>
<p> You can also check the Docker service status with:</p>
<pre><code class="lang-plaintext"> sudo systemctl status docker
</code></pre>
</li>
</ol>
<p>Now, Docker is successfully installed on your Linux VM, and you can start creating and managing Docker containers. Remember to refer to the documentation of your specific Linux distribution if you encounter any issues or need distribution-specific instructions.</p>
<h3 id="heading-steps-for-the-project">Steps for the project :</h3>
<ol>
<li><h4 id="heading-create-project-directory"><strong>Create Project Directory:</strong></h4>
</li>
</ol>
<pre><code class="lang-plaintext"># mkdir myjavaapp
# cd myjavaapp
</code></pre>
<p>2.<strong>Dockerfile Configuration:</strong></p>
<ul>
<li>Open the Dockerfile using a text editor (e.g., vi).</li>
</ul>
<pre><code class="lang-plaintext"># vi Dockerfile
</code></pre>
<p>Inside the Dockerfile, define the steps to build the container.</p>
<pre><code class="lang-plaintext"># Use a base image with Tomcat pre-installed
FROM tomcat:latest

# Copy the WAR file into the webapps directory
COPY https://mystorageaccount04oct23.blob.core.windows.net/myfolder/mahaLogin.war /usr/local/tomcat/webapps/

# Expose the default Tomcat port
EXPOSE 8080

# Start Tomcat when the container runs
CMD ["catalina.sh", "run"]
</code></pre>
<p>Save and exit the text editor.</p>
<h4 id="heading-3-build-the-docker-image">3. <strong>Build the Docker Image:</strong></h4>
<pre><code class="lang-plaintext"># docker build -t myjavaapp .
</code></pre>
<h4 id="heading-4-run-the-docker-container">4. <strong>Run the Docker Container:</strong></h4>
<pre><code class="lang-plaintext"># docker run -p 8080:8080 myjavaapp
</code></pre>
<p>The <code>-p</code> flag maps port 8080 from the container to the host.</p>
<h4 id="heading-5-access-the-application">5. <strong>Access the Application:</strong></h4>
<ul>
<li><p>Open a web browser and navigate to</p>
</li>
<li><pre><code class="lang-plaintext">  http://&lt;Public_IP?:8080/mahaLogin
</code></pre>
</li>
<li><p>You've successfully deployed your Java application in a Docker container!</p>
</li>
</ul>
<p>Understanding these steps will empower you to manage Tomcat effectively and deploy Java applications seamlessly within containers.</p>
]]></content:encoded></item><item><title><![CDATA[Grep Command in Linux]]></title><description><![CDATA[Grep Command
The Grep command can find or search a regular expression or a string in a text file. To demonstrate this, let’s create a text file welcome.txt and add some content as shown.
Welcome to Linux !
Linux is a free and opensource Operating sys...]]></description><link>https://techwithrishav.hashnode.dev/grep-command-in-linux</link><guid isPermaLink="true">https://techwithrishav.hashnode.dev/grep-command-in-linux</guid><category><![CDATA[Linux]]></category><category><![CDATA[command line]]></category><category><![CDATA[shell scripting]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Colud]]></category><dc:creator><![CDATA[Rishav Kuchiya]]></dc:creator><pubDate>Sun, 23 Apr 2023 19:12:12 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1682276853396/e4ea1581-88ca-40aa-b1a9-62e2a5387155.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-grep-command">Grep Command</h1>
<p>The Grep command can find or search a regular expression or a string in a text file. To demonstrate this, let’s create a text file <strong><em>welcome.txt</em></strong> and add some content as shown.</p>
<pre><code class="lang-bash">Welcome to Linux !
Linux is a free and opensource Operating system that is mostly used by
developers and <span class="hljs-keyword">in</span> production servers <span class="hljs-keyword">for</span> hosting crucial components such as web
and database servers. Linux has also made a name <span class="hljs-keyword">for</span> itself <span class="hljs-keyword">in</span> PCs.
Beginners looking to experiment with Linux can get started with friendlier linux
distributions such as Ubuntu, Mint, Fedora and Elementary OS.
</code></pre>
<p>Great! Now we are ready to perform a few grep commands and manipulate the output to get the desired results. To search for a string in a file, run the command below <strong>Syntax</strong></p>
<pre><code class="lang-bash">$ grep <span class="hljs-string">"string"</span> file name
</code></pre>
<p>or</p>
<pre><code class="lang-bash">$ filename grep <span class="hljs-string">"string"</span>
</code></pre>
<p>Example:</p>
<pre><code class="lang-bash">$ grep <span class="hljs-string">"Linux"</span> welcome.txt
</code></pre>
<p>Output:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682275722618/d5fe9c63-3437-49d8-aede-a75b31c2c5a8.png" alt class="image--center mx-auto" /></p>
<p>As you can see, grep has not only searched and matched the string “Linux” but has also printed the lines in which the string appears. If the file is located in a different file path, be sure to specify the file path as shown below</p>
<h2 id="heading-colorizing-grep-results-using-the-color-optionhttpswwwdigitaloceancomcommunitytutorialsgrep-command-in-linux-unixcolorizing-grep-results-using-the-color-option"><a target="_blank" href="https://www.digitalocean.com/community/tutorials/grep-command-in-linux-unix#colorizing-grep-results-using-the-color-option">Colorizing Grep results using the --color option</a></h2>
<p>If you are working on a system that doesn’t display the search string or pattern in a different color from the rest of the text, use the <code>--color</code> to make your results stand out. Example</p>
<pre><code class="lang-bash">$ grep --color <span class="hljs-string">"free and opensource"</span> welcome.txt
</code></pre>
<p>Output:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682276020975/92aebf71-3ead-49c8-b4a6-652075aebfc9.png" alt class="image--center mx-auto" /></p>
]]></content:encoded></item></channel></rss>