<?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: Laiba Zahoor</title>
    <description>The latest articles on DEV Community by Laiba Zahoor (@laibazahoor1).</description>
    <link>https://dev.to/laibazahoor1</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%2F679510%2F70bd2baa-4657-4ee6-ad61-6f2bde5391d5.png</url>
      <title>DEV Community: Laiba Zahoor</title>
      <link>https://dev.to/laibazahoor1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/laibazahoor1"/>
    <language>en</language>
    <item>
      <title>Deploying Angular App with multi-stage docker file plus tips/tricks on (Image Optimization)</title>
      <dc:creator>Laiba Zahoor</dc:creator>
      <pubDate>Mon, 13 Sep 2021 14:45:09 +0000</pubDate>
      <link>https://dev.to/laibazahoor1/deploying-angular-app-with-multi-stage-docker-file-plus-tips-tricks-on-image-optimization-87m</link>
      <guid>https://dev.to/laibazahoor1/deploying-angular-app-with-multi-stage-docker-file-plus-tips-tricks-on-image-optimization-87m</guid>
      <description>&lt;p&gt;It is very important to build efficient docker images using Dockerfile whenever pushing out images into production. We need images as small as possible in production for faster downloads, lesser surface attacks.&lt;/p&gt;

&lt;p&gt;In this article we'll cover  different points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Life without Multi-stage Build&lt;/li&gt;
&lt;li&gt;Image Optimization&lt;/li&gt;
&lt;li&gt;conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Life without Multi-Stage Build
&lt;/h2&gt;

&lt;p&gt;I have talked about dockerfile and how to build docker image for an application a fair bit in the past. As we build image for our angular application named as &lt;em&gt;angularapp&lt;/em&gt; in the last article when we build a basic Dockerfile, like the following,&lt;br&gt;
&lt;a href="https://media.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%2F69p9vrtrr98uw1rfh2mv.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F69p9vrtrr98uw1rfh2mv.PNG" alt="dockerfile"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;we end up with an image that size is astonishingly high which is 1.28GB.&lt;br&gt;
&lt;a href="https://media.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%2F50w53u7lbu0nstsr98h1.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F50w53u7lbu0nstsr98h1.PNG" alt="application image"&gt;&lt;/a&gt;&lt;br&gt;
We can’t ship the image of this size to production because of slower downloads. It takes longer than usual to download this image over the network.&lt;br&gt;
Another problem is the larger surface area which is prone to attacks. We included npm dependencies and the entire Angular CLI library in the image which are unnecessary in the final image.&lt;br&gt;
After facing all these difficulties, we came with different solutions through we can optimize our images:&lt;/p&gt;

&lt;h2&gt;
  
  
  Image Optimization:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Use a light base Image
&lt;/h3&gt;

&lt;p&gt;In Docker Hub (the public Docker repository) there are several images available for download, each with different characteristics and sizes.&lt;br&gt;
Normally, images based on Alpine  extremely small in size compared to those based on other Linux distributions, such as Ubuntu. So to optimize our image we'll use alpine image as a base image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fdy6utllml34q0jl7ftt5.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fdy6utllml34q0jl7ftt5.PNG" alt="dockerfile"&gt;&lt;/a&gt;&lt;br&gt;
By modifying the Dockerfile and using Alpine as a base, the final size of our image is 550MB:&lt;br&gt;
&lt;a href="https://media.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%2F50wa3i6en8e8g0aqoo5r.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F50wa3i6en8e8g0aqoo5r.PNG" alt="ALPINE image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Multi-Stage Dockerfile
&lt;/h3&gt;

&lt;p&gt;Basically &lt;em&gt;Multi-stage dockerfile&lt;/em&gt; is use  to minimize the size of the final container, improve run time performance, allow for better organization of Docker commands and files.&lt;br&gt;
Docker introduced multi-stage builds from version 17.05.&lt;br&gt;
With multi-stage builds, you can split your Dockerfile into multiple sections. Each stage has its own FROM statement so you can involve more than one image in your builds. Stages are built sequentially and can reference their predecessors, so you can copy the output of one layer into the next.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multi-Stage Builds in Action
&lt;/h3&gt;

&lt;p&gt;With multi-stage build, we can use multiple base images in the Dockerfile and copy artifacts, configuration files, etc. From one stage to another, so that we can discard what we don’t need.&lt;br&gt;
now let's create a Multi-stage dockerfile for our angular application. After this, the final size of our image will be in  MBs. &lt;br&gt;
Here’s a multi-stage Dockerfile which encapsulates our entire build:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fpjsnwqlmfbxl18j3ri02.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fpjsnwqlmfbxl18j3ri02.PNG" alt="Multistage dockerfile"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we have a Dockerfile with two stages: first stage will be use to build image for angular application and generate a dist folder which contain all the deployable files for angular application.&lt;br&gt;
Stage two will use another image to run an application.&lt;br&gt;
&lt;a href="https://media.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%2Fciblfsnnbdhimmvrcft3.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fciblfsnnbdhimmvrcft3.PNG" alt="Multi-stage"&gt;&lt;/a&gt;&lt;br&gt;
so the size of our image is 110MB.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this blog, We saw how to optimize our image from 1.28GB to 110MBs using different optimization methods.&lt;br&gt;
In my next blog we'll learn how to start multiple containers at once using docker compose.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reach me at
&lt;/h2&gt;

&lt;p&gt;You can follow me, contact me, ask questions, see what I do, or use my open source code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://twitter.com/zahoorlaiba1" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/in/laibazahoor/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://web.facebook.com/profile.php?id=100071485924848" rel="noopener noreferrer"&gt;Facebook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UCgU_zgdBpmt4ffPfuUkyLUA" rel="noopener noreferrer"&gt;YouTube&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Laiba-Zahoor" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Containerizing Angular App In A Docker Container</title>
      <dc:creator>Laiba Zahoor</dc:creator>
      <pubDate>Thu, 02 Sep 2021 14:52:40 +0000</pubDate>
      <link>https://dev.to/laibazahoor1/containerizing-angular-app-in-a-docker-container-1b16</link>
      <guid>https://dev.to/laibazahoor1/containerizing-angular-app-in-a-docker-container-1b16</guid>
      <description>&lt;h2&gt;
  
  
  Docker:
&lt;/h2&gt;

&lt;p&gt;If you are new to the docker journey go and explore my  &lt;a href="https://www.youtube.com/watch?v=3OLQDnH7A5M&amp;amp;t=6s" rel="noopener noreferrer"&gt;YouTube channel&lt;/a&gt; to watch my YouTube video, where I talked about what is docker and also about the container.&lt;/p&gt;

&lt;h2&gt;
  
  
  Content List:
&lt;/h2&gt;

&lt;p&gt;Nowadays, it’s very common to dockerize and deploy the Docker image in the production with the help of container orchestration engines such as Docker Swarm or Kubernetes.&lt;br&gt;
In this blog We are going to Dockerize the app and create an image and run it on Docker on our local machine for this, we need to perform the following steps: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating Angular Application.&lt;/li&gt;
&lt;li&gt;Create &lt;em&gt;Dockerfile&lt;/em&gt; in Angular App.&lt;/li&gt;
&lt;li&gt;Build &lt;em&gt;Docker image&lt;/em&gt; from Docker file.&lt;/li&gt;
&lt;li&gt;At the end run  containerized Angular Application on docker&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Angular.
&lt;/h2&gt;

&lt;p&gt;Before creating angular application we should have some basic knowledge about Angular so, Angular is a platform and framework use to built client side application using HTML,CSS and TypeScript. &lt;br&gt;
Before creating angular application, make sure that &lt;strong&gt;&lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;a href="https://angular.io/cli" rel="noopener noreferrer"&gt;Angular CLI&lt;/a&gt;&lt;/strong&gt;  already installed in your local system.&lt;br&gt;
&lt;em&gt;If you find any difficulty while installing Angular jump at&lt;/em&gt;  &lt;a href="https://angular.io/guide/setup-local" rel="noopener noreferrer"&gt;Angular Website&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating Angular Application:
&lt;/h2&gt;

&lt;p&gt;Once Nodejs and Angular installed, Execute &lt;code&gt;ng new angular-app&lt;/code&gt; command to create angular application in a local directory. &lt;br&gt;
&lt;a href="https://media.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%2Fe2p0axk4tdbmgfplrw7p.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fe2p0axk4tdbmgfplrw7p.PNG" alt="Creating Angular Application"&gt;&lt;/a&gt;&lt;br&gt;
Navigate project' directory and run Angular application using, &lt;em&gt;&lt;code&gt;ng serve&lt;/code&gt;&lt;/em&gt; command&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F9tnyj46s7pu3vhx6z8lh.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F9tnyj46s7pu3vhx6z8lh.PNG" alt="Localhost"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Create Dockerfile:
&lt;/h2&gt;

&lt;p&gt;A Docker image consists of read-only layers each of which represents a Dockerfile instruction. The layers are stacked and each one is a delta of the changes from the previous layer. Consider this Dockerfile:&lt;br&gt;
&lt;a href="https://media.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%2F2x5yqcsghyzrht4y1vu7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F2x5yqcsghyzrht4y1vu7.png" alt="Dockerfile"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;FROM&lt;/em&gt; – Initializes a new build stage, and sets the latest node image from DockerHub registry as the base image for executing subsequent instructions relevant to the angular app’s configuration. The stage is arbitrarily named as build, to reference this stage in the nodejs configuration stage.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;WORKDIR&lt;/em&gt; – Sets the default working directory in which the subsequent instructions are executed. The directory is created, if the path is not found. In the above snippet, an arbitrary path of app is chosen as the directory to move the angular source code into.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;COPY Package.Jeson&lt;/em&gt; - use to copy these files into the Docker file system and install all the dependencies. we need this to build image faster for example You've changed some src.js file, but haven't changed the package.json. You run npm and it looks good. Now you re-run docker build. Docker notices that the package*.json files haven't changed, so it uses the same image layer it built the first time without re-running anything, and it also skips the npm install step because it assumes running the same command on the same input filesystem produces the same output filesystem. So this makes the second build run faster. But if you missed it you need to install all dependencies every time you build image which ultimately slow down the image build process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;COPY&lt;/em&gt; – Copies the source files from the project’s root directory on the host machine to the specified working directory’s path on the container’s filesystem.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;RUN&lt;/em&gt; – Executes the angular build in a new layer on top of the base node image. After this instruction is executed, the build output is stored under /app and the compiled image will be used for the subsequent steps in the Dockerfile&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Building Docker Image:
&lt;/h2&gt;

&lt;p&gt;Building efficient Docker images are very important for faster downloads and lesser surface attacks. Let’s build an image with the Dockerfile. so for this, open up a command prompt and navigate to the location of your Dockerfile in your project’s directory.&lt;br&gt;
Execute the following command to build the docker image.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker build -t angular-app:latest "."&lt;/code&gt;&lt;br&gt;
In the above command as you see . is placed at the end of the command which shows that Dockerfile is present in the current working directory. but if in your case it's not present in the current working directory you can specify the path of Dockerfile at the end of the command.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fm0kg01l0thtf5ioghgq1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fm0kg01l0thtf5ioghgq1.gif" alt="Demo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/channel/UCgU_zgdBpmt4ffPfuUkyLUA?sub_confirmation=1" rel="noopener noreferrer"&gt;Watch the demo live| Subscribe to my channel&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/0C1ektNXot4"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;Docker virtualization is indeed an incredible technology. It can be used to virtualize almost any sort of application. Angular is mainly used to develop frontend web designs. &lt;br&gt;
In this article we learned how to create Docker file, how to build docker Image from it and after this how to run containerized Angular Application.&lt;br&gt;
Hopefully this article helped you to running a simple Angular application on Docker.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Next:
&lt;/h2&gt;

&lt;p&gt;In my next article I'll show you, how to orchestrate container in development machine using multi stage docker file and docker compose.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>My First Day of Learning Docker</title>
      <dc:creator>Laiba Zahoor</dc:creator>
      <pubDate>Wed, 11 Aug 2021 11:56:21 +0000</pubDate>
      <link>https://dev.to/laibazahoor1/my-first-day-of-learning-docker-4823</link>
      <guid>https://dev.to/laibazahoor1/my-first-day-of-learning-docker-4823</guid>
      <description>&lt;p&gt;Containers are quickly becoming an industry standard for deployment of software applications. But question here is: how containers came into being, so I came across &lt;a href="https://www.docker.com/" rel="noopener noreferrer"&gt;docker&lt;/a&gt; and I learned.&lt;/p&gt;

&lt;p&gt;In this blog I'll discuss what I have learned so far about docker.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is docker?&lt;/li&gt;
&lt;li&gt;Components of Docker&lt;/li&gt;
&lt;li&gt;Container vs VM&lt;/li&gt;
&lt;li&gt;Basic Commands.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Docker delivers software in containers, which simplifies the process by packaging everything it takes to run an application.&lt;/p&gt;

&lt;p&gt;There are numerous advantages to using containers to deploy applications.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Isolated&lt;/em&gt; — Applications have their own libraries; no conflicts will arise from different libraries in other applications.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Limited (limits on CPU/memory)&lt;/em&gt; — Applications may not hog resources from other applications.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Portable&lt;/em&gt; — The container contains everything it needs and is not tied to an OS or Cloud provider.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Lightweight&lt;/em&gt; — The kernel is shared, making it much smaller and faster than a full OS image.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Components of Docker
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Docker file&lt;/strong&gt;  is a text document that contains necessary commands which on execution helps assemble a Docker Image.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Docker Image&lt;/strong&gt; it is a set of instructions which is used to build containers, consisting of application code with all the dependencies and libraries. It is portable so it can easily be shared between developers and operators. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Container&lt;/strong&gt; is a way of packing application with all its dependencies and configuration files. A container is a running instance of our image. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Docker Engine&lt;/strong&gt; supports the tasks and workflows involved to build, ship and run container-based applications. The engine creates a server-side daemon process that hosts images, containers, networks and storage volumes. Docker Engine is a client-server based application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Docker CLI&lt;/strong&gt; is a command line tool that lets you talk to the Docker daemon.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  VM VS Container
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fusun26masw8vjuacfsoi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fusun26masw8vjuacfsoi.png" alt="Docker Vs VM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Containers&lt;/strong&gt; are an abstraction at the app layer that packages code and dependencies together. Multiple containers can run on the same machine and share the OS kernel with other containers, each running as isolated processes in user space. Container take up less space than VM's (Container images are typically tens of MB's in size), and start almost instantly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Virtual Machines(VM's)&lt;/strong&gt; are an abstraction of physical hard ware turning one server into many servers. The hypervisor allows multiple VM's to run on a single machine. Each VM includes a full copy of an Operating System, one or more apps, necessary binaries and libraries - taking up tens of GBs. VM can also be slow to boot.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic Commands:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Go to your favorite browser and Type docker over there click on download and Install docker on your favorite OS. So, I'm skipping these steps because it's a simple next, next wizard on Windows OS but if you having any difficulties installing docker on Linux OS or Mac OS go to the &lt;em&gt;&lt;a href="https://docs.docker.com/engine/install/" rel="noopener noreferrer"&gt;docs&lt;/a&gt;&lt;/em&gt; and explore how to do it. &lt;/li&gt;
&lt;li&gt;After the installation process is completed window like this will appear to you.
&lt;img src="https://media.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%2F25l3tcl8gnwy2zuh1h6f.png" alt="Docker Window"&gt;
&lt;/li&gt;
&lt;li&gt;Now move towards terminal to run basic commands.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;docker pull&lt;/em&gt; pulls an image from registry to local machine.
&lt;img src="https://media.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%2Fz9qi36w2p73we90ez7pc.PNG" alt="pull image"&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;docker images&lt;/em&gt; show images.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fxoakzi3s7vp5c1he7q15.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fxoakzi3s7vp5c1he7q15.PNG" alt="images"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;docker run&lt;/em&gt; both creates and runs a container in a single operation.&lt;br&gt;
&lt;a href="https://media.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%2Fw20s1pa0845nroi99h0b.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fw20s1pa0845nroi99h0b.PNG" alt="run"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;docker ps&lt;/em&gt; shows running containers.&lt;br&gt;
&lt;a href="https://media.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%2F7c2fspmmlxf805rs72v1.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F7c2fspmmlxf805rs72v1.PNG" alt="running container"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;docker stop&lt;/em&gt; stops a running container. &lt;br&gt;
&lt;a href="https://media.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%2Fozow2ty6nn3gvcixexq5.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fozow2ty6nn3gvcixexq5.PNG" alt="Stop container"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;docker ps -a&lt;/em&gt; shows running as well as stopped containers.&lt;br&gt;
&lt;a href="https://media.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%2Ffhty4xtmph0bvs0ayb6b.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Ffhty4xtmph0bvs0ayb6b.PNG" alt="view stop container"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;docker start&lt;/em&gt; starts a container to run it.&lt;br&gt;
&lt;a href="https://media.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%2F4tlv37vn7qviuabzhh7w.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F4tlv37vn7qviuabzhh7w.PNG" alt="restart"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So you have learned about the basics of Docker, the difference between Virtual Machines and Docker Containers along with components of Docker.&lt;/p&gt;

&lt;p&gt;In the next article, We'll try to create an application using Docker and pushed our images to Docker Hub. We'll explore more terminologies related to Docker Dockerfile, Docker Image, Docker Hub, Image repositories, Container Registries, and much more!!! &lt;/p&gt;

&lt;p&gt;If you want more content like this, you can follow me on &lt;a href="https://twitter.com/zahoorlaiba1" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, where I tweet about webdevelopment, self-improvement, and my journey to exploring Cloud Native Technologies!&lt;/p&gt;

&lt;h2&gt;
  
  
  What Next?
&lt;/h2&gt;

&lt;p&gt;Here are my Next Steps for Learning Docker on YouTube:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UCdngmbVKX1Tgre699-XLlUA" rel="noopener noreferrer"&gt;TechWorld with Nana&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UC0NErq0RhP51iXx64ZmyVfg" rel="noopener noreferrer"&gt;Bret Fisher&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UCorzANoC3fX9VVefJHM5wtA" rel="noopener noreferrer"&gt;Nick Janetakis
&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/user/djdjalas" rel="noopener noreferrer"&gt;Amigoscode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/user/scraly" rel="noopener noreferrer"&gt;Aurélie Vache&lt;/a&gt; (YT)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/aurelievache"&gt;Aurélie Vache&lt;/a&gt; (Dev.to) &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Video Link:
&lt;/h2&gt;

&lt;p&gt;if you prefer to watch video then go and watch my YouTube video &lt;a href="https://youtu.be/3OLQDnH7A5M" rel="noopener noreferrer"&gt;My First Day of learning Docker&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
