<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Abhishek Kumar Verma</title>
    <description>The latest articles on DEV Community by Abhishek Kumar Verma (@abhishekcs3459).</description>
    <link>https://dev.to/abhishekcs3459</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F953477%2F98e7a0db-8dc3-4723-8965-37f3bbe73bd2.png</url>
      <title>DEV Community: Abhishek Kumar Verma</title>
      <link>https://dev.to/abhishekcs3459</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abhishekcs3459"/>
    <language>en</language>
    <item>
      <title>Dockerise a Golang Application</title>
      <dc:creator>Abhishek Kumar Verma</dc:creator>
      <pubDate>Sun, 16 Jun 2024 19:43:40 +0000</pubDate>
      <link>https://dev.to/abhishekcs3459/dockerise-a-golang-application-25lc</link>
      <guid>https://dev.to/abhishekcs3459/dockerise-a-golang-application-25lc</guid>
      <description>&lt;p&gt;&lt;strong&gt;How can you call yourself a Golang developer without knowing how to Dockerize a Go application?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes, I know that feels very shameful, especially when working among your fellow teammates who are skilled developers.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Mention not, let's give them a good show!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Go setup&lt;/strong&gt;: You can download &amp;amp; install it from &lt;a href="https://go.dev/doc/install"&gt;Go Official website&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker&lt;/strong&gt;: Download and install from &lt;a href="https://www.docker.com"&gt;Docker's Official Website&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3c7lvscpobuydkkz5a4w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3c7lvscpobuydkkz5a4w.png" alt="meme image" width="498" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Create a Golang App or use my sample GoLang App by cloning it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/AbhishekCS3459/Docker_Blog_Series
&lt;span class="nb"&gt;cd &lt;/span&gt;Docker_Blog_Series/Dockerise_Go
go mod tidy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2 (optional): Run the Go application using the below command:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go run main.go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Expected Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdtolh47m5qn1qr41wdkf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdtolh47m5qn1qr41wdkf.png" alt="vscode output" width="599" height="68"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Simple Dockerfile for a go application:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff5gzlj2jh5yhx9aw16bh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff5gzlj2jh5yhx9aw16bh.png" alt="code image" width="670" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Build the Docker image using the following command:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker build YOUR_IMAGE_NAME &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;.&lt;/code&gt; represents that you are running the above command in the current directory where your Go application exists.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Check whether your image has been built or not by running the below command:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker images
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5: Run the container using the following command:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 8080:8080 YOUR_IMAGE_NAME
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Here, &lt;code&gt;-it&lt;/code&gt; is a flag to run the container in interactive mode, and &lt;code&gt;-p&lt;/code&gt; is for mapping the container port with the external port.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploy the Image to Docker Hub
&lt;/h2&gt;

&lt;p&gt;Docker Hub is a container registry built for developers and open-source contributors to find, use, and share their container images. With Hub, developers can host public repos that can be used for free, or private repos for teams and enterprises.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4jwh5qcrloy837aeg971.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4jwh5qcrloy837aeg971.png" alt="Dockerhub Image" width="734" height="308"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Log in to Docker Hub using the command:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will be prompted to enter your Docker Hub username and password.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Tag your Docker image with your Docker Hub repository name.
&lt;/h3&gt;

&lt;p&gt;Replace &lt;code&gt;YOUR_DOCKERHUB_USERNAME&lt;/code&gt; and &lt;code&gt;YOUR_IMAGE_NAME&lt;/code&gt; with your Docker Hub username and the name of your image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker tag YOUR_IMAGE_NAME YOUR_DOCKERHUB_USERNAME/YOUR_IMAGE_NAME
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Push Your Image to Docker Hub
&lt;/h3&gt;

&lt;p&gt;Push the tagged image to Docker Hub:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker push YOUR_DOCKERHUB_USERNAME/YOUR_IMAGE_NAME
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can now see your image on Docker Hub and share it with others!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3jil4r4mn2dbk60f57se.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3jil4r4mn2dbk60f57se.png" alt="docker file image" width="500" height="666"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  If you want to ask, ping me below.
&lt;/h3&gt;

&lt;p&gt;Connect with me on Linkedin:&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/abhishekverman/"&gt;linkedin/abhishekverman&lt;/a&gt;.&lt;br&gt;
Further Reading: &lt;strong&gt;&lt;a href="https://dev.to/comments/1192621"&gt;Dockerize a Nodejs Application&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>go</category>
    </item>
    <item>
      <title>Dockerize a Nodejs Application</title>
      <dc:creator>Abhishek Kumar Verma</dc:creator>
      <pubDate>Tue, 11 Jun 2024 14:32:13 +0000</pubDate>
      <link>https://dev.to/abhishekcs3459/dockerize-a-nodejs-application-5ei1</link>
      <guid>https://dev.to/abhishekcs3459/dockerize-a-nodejs-application-5ei1</guid>
      <description>&lt;p&gt;I feel very embarrassed when I claim to be a backend developer without basic Docker knowledge. Doesn't it feel the same to you?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;br&gt;
Before I start, make sure you have the following installed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Node.js&lt;/strong&gt; and &lt;strong&gt;npm:&lt;/strong&gt;.You can download and install it from the&lt;a href="https://nodejs.org/en"&gt; Node.js official website&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;2.&lt;strong&gt;Docker:&lt;/strong&gt; Download and install form &lt;a href="https://www.docker.com"&gt;Docker's Official Website.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frq05ac1bdb60xrgcul4y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frq05ac1bdb60xrgcul4y.png" alt="Begin Image" width="563" height="284"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step1: Create a Nodejs App or use my sample Nodejs App by cloning it
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/AbhishekCS3459/Node_Docker_Demo
cd Node_Docker_Demo
npm install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Step2 (Optional): Run the below command to run the application demo
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Step3: Run the below command to build the docker image
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build YOUR_IMAGE_NAME .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; . represents you are running the above command in the current directory where your node application exists.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step4: Check whether your image has build or not by running the below command
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker images
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Step5: Run the container using the following command
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -it -p 3000:3000 YOUR_IMAGE_NAME
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Here -it is a flag to run the container in interactive mode and -p for mapping the container port with the external port&lt;/p&gt;
&lt;h1&gt;
  
  
  Container:
&lt;/h1&gt;

&lt;p&gt;A Docker container is a lightweight, standalone, executable package that includes everything needed to run a piece of software, including the code, runtime, system tools, libraries, and settings. Containers isolate the application from its environment, ensuring consistent behavior across different environments.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs3jol8rcj1yl1rbnqp7x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs3jol8rcj1yl1rbnqp7x.png" alt="Docker Container Image" width="800" height="613"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Deploy the Image to Docker Hub
&lt;/h2&gt;

&lt;p&gt;To share your Docker image with others, you can deploy it to Docker Hub.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 1: Login to Docker Hub
&lt;/h3&gt;

&lt;p&gt;First, log in to Docker Hub using the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will be prompted to enter your Docker Hub username and password.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Tag Your Image
&lt;/h3&gt;

&lt;p&gt;Tag your Docker image with your Docker Hub repository name. Replace YOUR_DOCKERHUB_USERNAME and YOUR_IMAGE_NAME with your Docker Hub username and the name of your image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker tag YOUR_IMAGE_NAME YOUR_DOCKERHUB_USERNAME/YOUR_IMAGE_NAME
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 3: Push Your Image to Docker Hub&lt;br&gt;
Push the tagged image to Docker Hub:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker push YOUR_DOCKERHUB_USERNAME/YOUR_IMAGE_NAME
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can now see your image on Docker Hub and share it with others!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fohosnirqr77fiko61pd9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fohosnirqr77fiko61pd9.png" alt="Dev Image" width="600" height="417"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to ask, ping me below.&lt;br&gt;
Connect with me on Linkedin:&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/abhishekverman/"&gt;linkedin/abhishekverman&lt;/a&gt;.&lt;br&gt;
Further Reading: &lt;strong&gt;&lt;a href="https://dev.to/abhishekcs3459/dockerise-a-golang-application-25lc"&gt;Dockerize a Golang Application&lt;br&gt;
&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>node</category>
      <category>begginer</category>
    </item>
  </channel>
</rss>
