<?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: Vignesh Pb</title>
    <description>The latest articles on DEV Community by Vignesh Pb (@vigneshpb).</description>
    <link>https://dev.to/vigneshpb</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%2F2390063%2F89e7f230-2673-48b4-acb0-0c19b9e6fce1.jpg</url>
      <title>DEV Community: Vignesh Pb</title>
      <link>https://dev.to/vigneshpb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vigneshpb"/>
    <language>en</language>
    <item>
      <title>Docker for Dummies (Part 2)</title>
      <dc:creator>Vignesh Pb</dc:creator>
      <pubDate>Thu, 23 Jan 2025 15:11:53 +0000</pubDate>
      <link>https://dev.to/vigneshpb/docker-for-dummies-part-2-3aa9</link>
      <guid>https://dev.to/vigneshpb/docker-for-dummies-part-2-3aa9</guid>
      <description>&lt;p&gt;In the previous post we took a look at a simple explanation of what Docker is and why one should use it. In this post we will take a look at how to create and delete docker images. You should have Docker installed in your system to follow this blog&lt;/p&gt;

&lt;p&gt;As always this series is meant to be easy to understand and as such some topics will not be explained or will be covered at a later part when you are ready to work with them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Inspecting our System for Docker Images
&lt;/h2&gt;

&lt;p&gt;We can view the images that we have in our system by the &lt;em&gt;docker images&lt;/em&gt; command. You can see a sample of this output below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm6c2acv95zyut491cd6o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm6c2acv95zyut491cd6o.png" alt="Sample Output of the docker images command with no image" width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Right now there is no image so it just shows just the headings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing a docker file to create the most simplest image ever
&lt;/h2&gt;

&lt;p&gt;To create an image create an empty folder inside which where you will write your docker file. I named my folder as &lt;em&gt;dockerlearning&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;Create a file with any name that you want for the Docker File, however most engineers use the name &lt;em&gt;Dockerfile&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;We will learn how to build images by building the &lt;em&gt;simplest&lt;/em&gt; image possible&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2cjcwaj1li5t91yj6x1y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2cjcwaj1li5t91yj6x1y.png" alt="A sample docker file with just one line pulling alpine linux" width="800" height="249"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have a docker file which asks Docker to pull the alpine linux image. In other words our first image is just a bare bones version of alpine linux.&lt;/p&gt;

&lt;p&gt;All images follow the following name convention &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft04z421t55f1nfhg0cei.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft04z421t55f1nfhg0cei.png" alt="Image showing the naming convention all images follow" width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Where image_name is the &lt;em&gt;name of the image&lt;/em&gt; while tag_name represents the &lt;em&gt;version of the image&lt;/em&gt;. The version of the image can be anything that resembles a version like 1.3, 2.5, latest, rolling etc &lt;/p&gt;

&lt;p&gt;If you do not specify the tag name, docker will assume the tag name is &lt;em&gt;latest&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Building your docker image
&lt;/h2&gt;

&lt;p&gt;Once you have written the docker file, you can build an image out of it with the following command &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fer7io3zlmab7xlfuky24.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fer7io3zlmab7xlfuky24.png" alt="Image showing the command to build a docker file" width="800" height="215"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above command builds an image called &lt;strong&gt;my_first_image:latest&lt;/strong&gt; from the docker file &lt;strong&gt;Dockerfile&lt;/strong&gt;. You can actually ignore the &lt;em&gt;-f Dockerfile&lt;/em&gt; portion of your command if you name your docker file as &lt;strong&gt;Dockerfile&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once you do this, docker starts building an image from your Docker file and the process of building gives an output in your terminal which looks something similar to the below image&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fak3ppry9qkhtjy61t31s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fak3ppry9qkhtjy61t31s.png" alt="Sample Build output of a Docker build command" width="800" height="564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the build is done, you can check your system if you have any images again with the &lt;em&gt;docker images&lt;/em&gt; command. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21e3one4rnk8cxmkewh1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21e3one4rnk8cxmkewh1.png" alt="Output of docker images command after build" width="800" height="232"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we see that docker is listing that we have an image with the tag that we gave it alone with an &lt;strong&gt;&lt;em&gt;IMAGE ID&lt;/em&gt;&lt;/strong&gt; and the size for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deleting your Docker Image
&lt;/h2&gt;

&lt;p&gt;If you ever want to delete a docker image that you created you can do so by running the following command&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftp87davnn2898zzneghx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftp87davnn2898zzneghx.png" alt="Output of Docker Image Deletion Command" width="800" height="232"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Running the &lt;em&gt;docker rmi&lt;/em&gt; command with the image ID will delete the image&lt;/p&gt;

&lt;p&gt;Now if you run the &lt;em&gt;docker images&lt;/em&gt; command you will see nothing listed again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;In this blog post, we saw the following&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to list the docker images in our computer with the &lt;em&gt;docker images&lt;/em&gt; command&lt;/li&gt;
&lt;li&gt;How to write a very simple docker file &lt;/li&gt;
&lt;li&gt;How to build a docker image with the &lt;em&gt;docker build&lt;/em&gt; command&lt;/li&gt;
&lt;li&gt;How to delete a docker image with the &lt;em&gt;docker rmi&lt;/em&gt; command&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Some Homework for you
&lt;/h2&gt;

&lt;p&gt;Here are some questions for you to ensure that you get more practice and that you understand the process that is going on &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is alpine linux the only image that can be pulled? &lt;/li&gt;
&lt;li&gt;Are operating systems the only images that can be pulled?&lt;/li&gt;
&lt;li&gt;Wasn't the whole point of containers to run your software without interference from other software? How does pulling an OS image solve this? Or are we missing something yet? &lt;/li&gt;
&lt;li&gt;What happens when we create another image with the same name?&lt;/li&gt;
&lt;li&gt;Where are the created images stored? &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;In the next blog post, we will take a look at creating docker images that are much more detailed that the one line docker file that we used right now and we will dive into some additional commands that we can write in the Docker file&lt;/p&gt;

</description>
      <category>docker</category>
      <category>container</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Docker for Dummies (Part 1)</title>
      <dc:creator>Vignesh Pb</dc:creator>
      <pubDate>Mon, 20 Jan 2025 13:54:29 +0000</pubDate>
      <link>https://dev.to/vigneshpb/docker-for-dummies-part-1-38kk</link>
      <guid>https://dev.to/vigneshpb/docker-for-dummies-part-1-38kk</guid>
      <description>&lt;p&gt;In this post we will be taking a look at Docker from the perspective of a complete beginner and how to use it.&lt;/p&gt;

&lt;p&gt;This post is Part 1 of a multi-part series with each part discussing a different component or a component with an additional layer of depth. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This blog is deliberately meant to be simple and easy to understand and as such some topics will not be covered or will be covered in a later part when you are ready to work with them&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Docker?
&lt;/h2&gt;

&lt;p&gt;Docker is a piece of software that is used to manage (create/run/delete) containers. A container is an enclosed space where our software can run without other software interfering with it. &lt;/p&gt;

&lt;h2&gt;
  
  
  When do I use Docker?
&lt;/h2&gt;

&lt;p&gt;Here are some situations where docker would be useful for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Example Situation 1: Managing different Software Versions &lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
Say you have two websites which require the following software versions to run &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Website 1 - PHP 8.1 and MySQL 5.7&lt;/li&gt;
&lt;li&gt;Website 2 - PHP 7.2 and MySQL 8.0&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To make these websites work, you need to ensure each uses the correct PHP and MySQL versions. This can be tricky, especially if you need to run multiple versions simultaneously&lt;/p&gt;

&lt;p&gt;If you are like me then doing this could be annoying and difficult because whenever you try to meddle with your PHP/MySQL installation it breaks causing you to spend time fixing it all day&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Example Situation 2: Managing consistency between team members&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
Say you are working on a piece of software that needs Redis version 5.0.5 and once you finish building your software you push it to Github.&lt;/p&gt;

&lt;p&gt;Now your colleague pulls the code and runs it but it &lt;strong&gt;&lt;em&gt;breaks&lt;/em&gt;&lt;/strong&gt; because they are running Redis version 5.0.4&lt;/p&gt;

&lt;p&gt;A small version change broke your software and you as a developer get frustrated because your complaint is "But it worked in my computer" &lt;/p&gt;

&lt;p&gt;In both of the above situations, Docker is a great solution that solves the problem&lt;/p&gt;

&lt;h2&gt;
  
  
  How does the Docker Software Work?
&lt;/h2&gt;

&lt;p&gt;The docker software runs like a client-server software. The server runs a process called &lt;strong&gt;&lt;em&gt;dockerd&lt;/em&gt;&lt;/strong&gt; (Docker Daemon) which the users can interact with with a CLI (Command Line Interface) or the Docker UI (User Interface)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkzn9hpmgb2tcr9cd53rl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkzn9hpmgb2tcr9cd53rl.png" alt="Image description" width="311" height="61"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: If you do not know what REST API is, don't worry about it too much for now. As long as you understand that &lt;em&gt;dockerd&lt;/em&gt; is the program that runs your commands you should be good to go&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the Workflow?
&lt;/h2&gt;

&lt;p&gt;Using the Docker engine is very simple, the workflow is shown below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F248glp6mer0iefxgfdwv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F248glp6mer0iefxgfdwv.png" alt="Image description" width="501" height="171"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The steps are as follows&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You create a dockerfile which contains instructions of what software you need and what you want to do with it&lt;/li&gt;
&lt;li&gt;You give it to the Docker Software and ask it to create an &lt;em&gt;image&lt;/em&gt; which is like a blueprint of the requirements for your project (eg PHP 8.1 and MySQL 5.7)&lt;/li&gt;
&lt;li&gt;Once you have the image you can then give it again to the Docker Software and create a container with the specific versions of the software that you wanted.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you create an image you can share it with your fellow developers  by uploading the image to websites called as &lt;em&gt;registries&lt;/em&gt;. These registries can be specific to a company to be shared between team members but there are also registries that the general public uses and shares images publicly.&lt;/p&gt;

&lt;p&gt;Some common registries are &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dockerhub&lt;/li&gt;
&lt;li&gt;Amazon Elastic Container Registry&lt;/li&gt;
&lt;li&gt;Google Container Registry&lt;/li&gt;
&lt;li&gt;Azure Container Registry&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;So far in this blog post, we saw the answers to the following questions&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is Docker? - A tool to manage containers&lt;/li&gt;
&lt;li&gt;What problems does it solve? - Gives an enclosed space to run your software without interference from other software&lt;/li&gt;
&lt;li&gt;How does the Docker software operate ? - A client server model, where the client is either the cli or the docker ui&lt;/li&gt;
&lt;li&gt;What does a typical workflow look like? - You create a file and then create an image and then start the container&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Terminology Recap
&lt;/h2&gt;

&lt;p&gt;Here are a list of new terms that you guys would have seen in this blog post.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Containers&lt;/li&gt;
&lt;li&gt;Images&lt;/li&gt;
&lt;li&gt;Docker&lt;/li&gt;
&lt;li&gt;Registries&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Some homework for you
&lt;/h2&gt;

&lt;p&gt;To ensure that you learn better here are some questions from me that you can ask yourself to strengthen your knowledge on docker&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is docker the only software that helps in containerization? Does the docker company have competitors? If so who are they?&lt;/li&gt;
&lt;li&gt;What are some other registry websites? Which are the most popular ones? What registries do companies prefer? What registries do hobby developers prefer? &lt;/li&gt;
&lt;li&gt;Go to a registry website and browse it once to see what is inside it.&lt;/li&gt;
&lt;li&gt;Why do we need to create an image first and then a container? Why not create a container directly from the dockerfile?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is okay if you do not find the answers to these questions right away, the best way to learn is to sit with these questions and refer online resources and slowly learn :)&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;In the next blog post we will actually run docker commands to create images, containers and will experiment with different scenarios&lt;/p&gt;

</description>
      <category>docker</category>
      <category>container</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
