<?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 Anupamaem on Medium]]></title>
        <description><![CDATA[Stories by Anupamaem on Medium]]></description>
        <link>https://medium.com/@anupamaem923?source=rss-be96f06b75b0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*DMyR5E_K8QMZftOy</url>
            <title>Stories by Anupamaem on Medium</title>
            <link>https://medium.com/@anupamaem923?source=rss-be96f06b75b0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 08:59:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anupamaem923/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 Demystified: A Beginner-Friendly Guide from Architecture to Multi-Container Apps]]></title>
            <link>https://medium.com/@anupamaem923/docker-demystified-a-beginner-friendly-guide-from-architecture-to-multi-container-apps-5008a5a045ce?source=rss-be96f06b75b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/5008a5a045ce</guid>
            <category><![CDATA[docker-basic]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[docker-network]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Anupamaem]]></dc:creator>
            <pubDate>Wed, 10 Jun 2026 15:41:43 GMT</pubDate>
            <atom:updated>2026-06-10T15:41:43.955Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>Ever run into the infamous “Well, it works on my machine” problem? We have all been there. Developers frequently waste hours debugging code that runs perfectly locally but breaks the moment it hits a testing server or production environment.</p><p>Enter Docker, an open-source platform designed to eliminate this exact friction. Docker automates the deployment of applications inside lightweight, portable containers. By packaging your software alongside all its mandatory dependencies, libraries, and configurations, Docker guarantees your application behaves identically across any system.</p><p>While Docker didn’t technically invent containerization, it undeniably popularized it by making it fast, efficient, and highly accessible.</p><h3>The Mental Model: What is Docker, Exactly?</h3><p>To understand Docker, it helps to separate the concepts using everyday analogies.</p><p><strong>The Dockerfile (The Recipe)</strong></p><p>A simple text file filled with step-by-step instructions on how to assemble your application environment.</p><p><strong>The Docker Image (The Cake Mix)</strong></p><p>A frozen, read-only template built from your Dockerfile. It contains your code, runtime, and tools packaged and ready.</p><p><strong>The Container (The Baked Cake)</strong></p><p>The living, breathing, executable instance of your image running on a machine.</p><p><strong>Docker Containers vs. Virtual Machines</strong></p><p>Unlike bulky Virtual Machines (VMs) that bundle a whole guest operating system, Docker containers share the host operating system kernel. This architectural shortcut makes containers incredibly lightweight, fast to boot, and highly resource-efficient.</p><p>Inside the Docker Architecture</p><p>Docker uses a client-server architecture split into a few core internal components.</p><p><strong>Docker Client (CLI)</strong></p><p>Your command center. This is where you type commands like docker build or docker run. It relays your instructions via a REST API to the background system.</p><p><strong>Docker Host (Engine &amp; Daemon)</strong></p><p>The heavy lifter. It runs a background process called the Daemon (dockerd), which acts as the brain responsible for managing, building, and running your containers and images.</p><p><strong>Docker Registry</strong></p><p>A central repository where images are stored and shared. Docker Hub is the largest public registry in the world, similar to GitHub but for Docker images.</p><p>The Build, Ship, Run Workflow</p><p>The fundamental lifecycle of a Docker application boils down to three sequential steps.</p><ol><li>BUILD (From Code to Blueprint)</li></ol><p>You draft a Dockerfile defining your environment requirements, such as installing Linux, installing Java, and copying application code. Running docker build prompts the Docker Daemon to compile this text file into an immutable, read-only image.</p><ol><li>SHIP (To the Warehouse)</li></ol><p>You execute docker push to upload your local image safely to a registry like Docker Hub, allowing your team or production servers to access it from anywhere.</p><ol><li>RUN (From Blueprint to Reality)</li></ol><p>On the target deployment server, you trigger docker pull to fetch the image from the registry. Running docker run commands the engine to place a thin writable layer on top of that read-only image, executing it instantly as an active container.</p><p>Breaking Down a Real Dockerfile</p><p>Let’s dissect a common Dockerfile configuration to understand the commands driving automation.</p><pre>FROM eclipse-temurin:21</pre><pre>WORKDIR /app</pre><pre>COPY target/example.jar /app/example.jar<br>COPY target/lib/ /app/lib/</pre><pre>EXPOSE 8080</pre><pre>CMD [&quot;java&quot;, &quot;-jar&quot;, &quot;example.jar&quot;]</pre><p>Essential Dockerfile Commands to Know</p><p><em>FROM</em></p><p>Sets the baseline image your environment builds upon.</p><p><em>WORKDIR</em></p><p>Sets the working directory path inside the container context.</p><p><em>COPY</em></p><p>Transports files or directories from your local filesystem into the container filesystem.</p><p><em>RUN</em></p><p>Executes terminal commands during the image build phase, such as:</p><pre>RUN apt-get update</pre><p><strong>CMD vs ENTRYPOINT</strong></p><p>CMD defines the default program that starts when your container launches, whereas ENTRYPOINT ensures a specific executable always runs on startup.</p><p><strong>ENV and ARG</strong></p><p>ENV injects runtime environment variables, while ARG sets temporary variables used strictly during the image build process.</p><p><strong>Data Management: Volumes vs. Bind Mounts</strong></p><p>Because containers are inherently ephemeral, any data created inside them disappears the moment the container is deleted. Docker solves this data persistence problem in two ways.</p><p><strong>Docker Volumes</strong></p><p>Management: Entirely managed by Docker.</p><p>Storage Location: /var/lib/docker/volumes/ on Linux.</p><p>Best Used For: Production environments, databases, and secure long-term storage.</p><p>Lifecycle: Outlives the container and requires explicit deletion.</p><p><strong>Bind Mounts</strong></p><p>Management: Managed by the user through host machine paths.</p><p>Storage Location: Anywhere you choose on your host machine.</p><p>Best Used For: Development environments with real-time code synchronization.</p><p>Lifecycle: Directly tied to the host folder’s state.</p><p><strong>Quick Syntax Tip</strong></p><p>You can set up data mapping using the older -v flag or the modern --mount syntax.</p><pre>docker run -d --mount type=bind,source=&quot;$(pwd)&quot;/target,target=/app nginx:latest</pre><p><strong>Networking and Port Mapping</strong></p><p>Containers operate inside their own isolated network stack. If a web server inside a container listens on port 3000, it remains completely hidden from the host machine or external internet traffic by default.</p><p>To make your application accessible externally, you must map a host port to a container port using the -p flag.</p><pre>docker run -p [HOST_PORT]:[CONTAINER_PORT] [IMAGE_NAME]</pre><p>Example:</p><pre>docker run -p 3000:3000 node-app</pre><p>Once configured, outside traffic targeting http://localhost:3000 is transparently forwarded into your container.</p><p><strong>Connecting Container to Container</strong></p><p>Docker offers a built-in networking feature so containers can securely communicate with each other by name instead of dynamic IP addresses.</p><pre>docker network create my-custom-net</pre><pre>docker run --name database -d --network my-custom-net mongo</pre><p>Any application container placed on my-custom-net can now find the database container simply by using the hostname:</p><pre>mongodb://database</pre><p><strong>Moving to Multi-Container Apps with Docker Compose</strong></p><p>Running one container manually via CLI commands is easy enough, but managing a modern application stack consisting of a frontend, API service, vector database, and cache backend quickly becomes difficult.</p><p>Docker Compose allows you to orchestrate multi-container application stacks using a single configuration file named docker-compose.yml.</p><pre>version: &#39;3.8&#39;</pre><pre>services:<br>  api:<br>    build: .<br>    ports:<br>      - &quot;8000:8000&quot;<br>    depends_on:<br>      - qdrant</pre><pre>  qdrant:<br>    image: qdrant/qdrant<br>    volumes:<br>      - qdrant_data:/qdrant/storage</pre><pre>volumes:<br>  qdrant_data:</pre><p>Essential Commands Cheat Sheet</p><p><strong>Download an image</strong></p><p>Docker:<br>docker pull &lt;image&gt;</p><p>Docker Compose:<br>Handled automatically</p><p><strong>Start services</strong></p><p>Docker:<br>docker run -d &lt;image&gt;</p><p>Docker Compose:<br>docker compose up</p><p><strong>Stop services</strong></p><p>Docker:<br>docker stop &lt;container-id&gt;</p><p>Docker Compose:<br>docker compose down</p><p><strong>View logs</strong></p><p>Docker:<br>docker logs &lt;container-id&gt;</p><p>Docker Compose:<br>docker compose logs &lt;service&gt;</p><p><strong>Check running processes</strong></p><p>Docker:<br>docker ps -a</p><p>Docker Compose:<br>docker compose ps</p><p><strong>Execute commands inside a container</strong></p><p>Docker:<br>docker exec -it &lt;id&gt; bash</p><p>Docker Compose:<br>docker compose run &lt;service&gt; bash</p><p>Conclusion</p><p>Docker wraps your applications in an indestructible layer of consistency, portability, and isolated scale. Mastering how images, containers, volumes, and networking interconnect is the first step toward building modern, cloud-native deployments that work flawlessly on every machine.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5008a5a045ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>