<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Afees p s on Medium]]></title>
        <description><![CDATA[Stories by Afees p s on Medium]]></description>
        <link>https://medium.com/@afeesps?source=rss-c388cf3745b2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*t8VgXeTA1WUOhGc5.</url>
            <title>Stories by Afees p s on Medium</title>
            <link>https://medium.com/@afeesps?source=rss-c388cf3745b2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 16:14:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@afeesps/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Docker in a Day]]></title>
            <link>https://medium.com/@afeesps/docker-in-a-day-46618a30140e?source=rss-c388cf3745b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/46618a30140e</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[hello-world]]></category>
            <dc:creator><![CDATA[Afees p s]]></dc:creator>
            <pubDate>Sat, 20 Jun 2020 13:15:27 GMT</pubDate>
            <atom:updated>2020-06-20T14:09:40.091Z</atom:updated>
            <content:encoded><![CDATA[<h3>Docker is simple</h3><h4>Learn docker the simple way.</h4><p><em>How long you have been hearing Docker?Did you get the chance to go to learn the practical side of Docker</em>.<em>Then</em> <em>this is the place to start.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*OOUJ3NyR6CbK368ImSbo8A.png" /><figcaption>Copyright: <a href="https://deploybot.com/">deploybot</a></figcaption></figure><h3>What is docker?</h3><p><em>Docker </em>is a tool that helps us to package Application code and its dependencies like (external libs and other dependencies) and runs it as a container. Like any other application it can be installed on you system.</p><h3><strong>Container vs Virtual machiner</strong></h3><p>Before starting let us have look at the difference between a container and virtual machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MptXFyKOaUeRWusWa9-Rvw.png" /><figcaption>Container Vs Virtual Machine</figcaption></figure><p><strong>Container : </strong>Container is an instance of an image(consists of Application and its dependencies) running on top of a Container Engine(Docker Engine).</p><p><strong>Virtual Machines :</strong> Virtual machine consists of a Guest OS and Application running over a hypervisor.</p><h3><strong>Image and Container</strong></h3><p>A <em>container</em> is nothing but a running version of an <em>Image</em>.An image has the required binary and its dependencies bundled together.You can create any number of containers using a single image.</p><p><a href="https://hub.docker.com/">Docker Hub</a> is a cloud-based repository in which Docker users and partners store,test and manage container images.we can create our image and upload it to docker hub.Also we can make use of already uploaded images.</p><h3>Install Docker</h3><p>Download the Docker Desktop Installer for windows from <a href="https://hub.docker.com/editions/community/docker-ce-desktop-windows/">DockerHub</a></p><p>Double click the Installer.Once the installation finishes you will get a Notification at the task bar.</p><p>For Ubuntu : <a href="https://docs.docker.com/engine/install/ubuntu/">https://docs.docker.com/engine/install/ubuntu/</a></p><p>For Mac :<a href="https://docs.docker.com/docker-for-mac/install/">https://docs.docker.com/docker-for-mac/install/</a></p><h3>Test docker</h3><p>1.Once the installation is done,verify docker has been succesfully installed.</p><pre>&gt; docker --version<br><br>Docker version 19.03.1</pre><p>Yey!! now you are ready to go.</p><h3>It’s time to run our First Application</h3><p>We use the docker <em>run </em>command for running a docker container.</p><pre>$ docker run hello-world</pre><pre>Unable to find image &#39;hello-world:latest&#39; locally<br>latest: Pulling from library/hello-world<br>ca4f61b1923c: Pull complete<br>Digest:sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7<br>Status: Downloaded newer image for hello-world:latest</pre><p>docker “run” command will pull the image from the DockerHub and bringup the container instance.</p><p><em>Note :</em> hello-world image is a standard image available in docker hub</p><h3>Pulling an Image From Docker hub</h3><p>Docker maintains a local repository to store the docker images,docker <em>pull </em>will download and store the specified image to local repository.</p><pre>$ docker pull debian</pre><pre>Using default tag: latest<br>latest: Pulling from library/debian<br>fdd5d7827f33: Pull complete<br>a3ed95caeb02: Pull complete<br>Digest:sha256:e7d38b3517548a1c71e41bffe9c8ae6d6d29546ce46bf62159837aad072c90aa<br>Status: Downloaded newer image for debian:latest</pre><p>The command pulls the <em>debian:latest</em> image form DockerHub repo:<br> If no <em>tag</em> is provided for <em>debain</em>, Docker Engine uses the <em>:latest</em> tag as a default.</p><ol><li><strong>Layer Reuse</strong></li></ol><p>Once we have downloaded the debian latest image,we can download a separate layer on top of the <em>debian:latest.</em></p><pre>$ docker pull debian:jessie</pre><pre>jessie: Pulling from library/debian<br>fdd5d7827f33: Already exists<br>a3ed95caeb02: Already exists<br>Digest:sha256:a9c958be96d7d40df920e7041608f2f017af81800ca5ad23e327bc402626b58e<br>Status: Downloaded newer image for debian:jessie</pre><p>Layers can be reused by images.below commands pulls on the metadata as all its layers are already present locally.Only metadata <em>jessie: Pulling from library/debian </em>has been downloaded additionally, rest of layers are resused from the existing image.</p><h3>List Images</h3><pre>$ docker images <br>    REPOSITORY   TAG      IMAGE ID        CREATED      SIZE<br>    debian       jessie   f50f9524513f    5 days ago   125.1 MB<br>    debian       latest   f50f9524513f    5 days ago   125.1 MB</pre><p>Docker command <em>images </em>will show list down the images that we build or pull.</p><ol><li><strong>Tagging a Docker image</strong></li></ol><p>When you have multiple images it becomes difficult to manage and identify images for that docker allows tagging of images using <em>-t </em>option.</p><pre>$ docker build -t yourusername/repository-name .</pre><p>If you run the command above, you should have your image tagged already. Running <strong>docker images </strong>again will show your image with the name you’ve chosen.</p><pre>$ docker images <br>    REPOSITORY   TAG      IMAGE ID        CREATED      SIZE<br>    debian       jessie   f50f9524513f    5 days ago   125.1 MB<br>    debian       latest   f50f9524513f    5 days ago   125.1 MB<br>    psworld/app1 latest   be083a8e3159    7 days ago   83.2MB</pre><h3>Building your own image</h3><p>We have seen how to make use of a pre-existing image to bring up a container.Docker provides us the flexibility to create our own image.</p><p>Let us see how an image is buid using docker build command.</p><p>Here are going to build an image which uses a base image(pre-designed).</p><p>1.We should have a Dockerfile to specify the rules for building image.Folder structure mentioned below.</p><pre>MyFolder-----<br>            |<br>            |<br>            |-------DockerFile<br>            |<br>            |-------notes</pre><p>2.Following is the content of DockerFile.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a455a6ddaa32cf0a301fb19c40fba9ec/href">https://medium.com/media/a455a6ddaa32cf0a301fb19c40fba9ec/href</a></iframe><p>This will build an image with debian:sid as the base Image and commit the outputs of the commands RUN commands to the image on top of the base image and copy the file <em>notes</em> to <em>/tmp/ </em>directory.</p><p>DockerFile Instructions:</p><ol><li><strong>FROM : </strong><strong>FROM </strong>instruction initializes a new build stage and sets the Base Image for subsequent instructions.a DockerFile must start with a this instruction.</li><li><strong>COPY :</strong>The COPY instruction copies new files or directories from &lt;src&gt; and adds them to the filesystem of the container at the path &lt;dest&gt;</li><li><strong>RUN : </strong>The RUN instruction will execute any commands in a new layer on top of the current image and commit the results.</li><li><strong>CMD :</strong>There can only be one CMD instruction in a Dockerfile. If you list more than one CMD then only the last CMD will take effect.</li><li><strong>ENTRYPOINT :</strong>An ENTRYPOINT allows you to configure a container that will run as an executable.it will override the CMD configurations.</li></ol><p>Note : This is a minimal set of instructions.</p><p>3.Building the image</p><p>Once you have DockerFile and the required dependenies ready,create the image for your application.</p><pre>docker build -t my-docker-image</pre><p><strong>Note:</strong> ‘-t’ specifies the name of your image,instead of ‘my-docker-image’ provide your name of choice.</p><h3><strong>Uploading the Image to DockerHub</strong></h3><p>We have created our first Image,You can share it with world by uploading the image to <a href="https://hub.docker.com/">DockerHub</a>.</p><pre>docker push yourdockerhubusername/imagename</pre><p>Note: A valid DockerHub account is required for uploading the image and there you go.</p><p>Have a Docker day!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46618a30140e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>