<?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: Hosea Mutwiri</title>
    <description>The latest articles on DEV Community by Hosea Mutwiri (@hoseamutwiri).</description>
    <link>https://dev.to/hoseamutwiri</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3819046%2Ffee39f3f-4524-4bec-8fb3-7e9dd0492bf7.png</url>
      <title>DEV Community: Hosea Mutwiri</title>
      <link>https://dev.to/hoseamutwiri</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hoseamutwiri"/>
    <language>en</language>
    <item>
      <title>The Ultimate Docker Guide: Core Concepts &amp; Commands 🐳</title>
      <dc:creator>Hosea Mutwiri</dc:creator>
      <pubDate>Thu, 25 Jun 2026 15:42:42 +0000</pubDate>
      <link>https://dev.to/hoseamutwiri/the-ultimate-docker-guide-core-concepts-commands-150k</link>
      <guid>https://dev.to/hoseamutwiri/the-ultimate-docker-guide-core-concepts-commands-150k</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Docker Core Concepts&lt;/li&gt;
&lt;li&gt;Virtual Machines vs. Containers&lt;/li&gt;
&lt;li&gt;Docker Architecture&lt;/li&gt;
&lt;li&gt;Docker Installation on Linux&lt;/li&gt;
&lt;li&gt;Docker Command Reference&lt;/li&gt;
&lt;li&gt;Dockerfile Authoring&lt;/li&gt;
&lt;li&gt;Reference Documentation&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  1. Docker Core Concepts
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is a Container?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A container is a lightweight, isolated process running on a shared operating system kernel.&lt;br&gt;
It is packaged with everything it needs to run, including code, libraries, environment variables, runtime, and configuration files.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frly7solldgigl8iosd75.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frly7solldgigl8iosd75.PNG" alt="A container" width="799" height="500"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Key Features of Containers&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No Separate OS:&lt;/strong&gt; Shares the host operating system kernel directly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Isolated Environment:&lt;/strong&gt; Runs as a self-contained process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fast Lifecycle:&lt;/strong&gt; Quick to create, start, and tear down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repeatable:&lt;/strong&gt; Behaves identically across different environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Portable:&lt;/strong&gt; Works seamlessly on local laptops, VMs, or the cloud. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalable:&lt;/strong&gt; Easily multiplied to handle increased traffic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Container Engines&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To build, ship, and run containers, you need a container runtime engine installed&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Docker:&lt;/strong&gt; is the most popular container engine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Other Engines:&lt;/strong&gt; Linux Containers (LXC), containerd, and CRI-O.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Virtual Machines vs. Containers
&lt;/h2&gt;

&lt;p&gt;The structural divergence between Virtual Machines (VMs) and Containers defines their respective resource profiles and deployment speeds:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Virtual Machines (VMs)&lt;/th&gt;
&lt;th&gt;Containers&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Architecture&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Runs via a Hypervisor.&lt;/td&gt;
&lt;td&gt;Shares the host OS kernel.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Weight&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Heavyweight&lt;/td&gt;
&lt;td&gt;Lightweight&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scalability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Slow boot times&lt;/td&gt;
&lt;td&gt;Near-zero startup times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Portability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Bound to hypervisor standards&lt;/td&gt;
&lt;td&gt;Highly portable across any OS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;OS Overhead&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Redundant guest OS overhead&lt;/td&gt;
&lt;td&gt;Shares the host OS kernel&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Image Management&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Inefficient image management&lt;/td&gt;
&lt;td&gt;Efficient, layered image management&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  3. Docker Architecture
&lt;/h2&gt;

&lt;p&gt;Docker uses a client-server architecture to simplify building, running, managing, and distributing applications. It is an open-source platform developed by Docker Inc.&lt;br&gt;
&lt;strong&gt;Architectural Components&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Docker Client:&lt;/strong&gt; The primary interface (docker CLI) that enables users to interact with Docker by sending commands.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Host:&lt;/strong&gt; The physical server or Virtual Machine (VM) on which the Docker engine is installed and running.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Daemon (dockerd):&lt;/strong&gt; The heart of Docker. It listens for Docker API requests from the client and manages containers, images, networks, and volumes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Images:&lt;/strong&gt; Read-only binary templates containing the application and its dependencies used to build containers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Containers:&lt;/strong&gt; The encapsulated, runnable instances of a Docker image where applications actually execute.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Registries:&lt;/strong&gt; Storage repositories used to hold and share Docker images (e.g., Docker Hub).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fikwh1hj0b23zvpa3gsxt.PNG" alt="Locating a docker image" width="799" height="344"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  4. Docker Installation on Linux
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Official Reference:&lt;/em&gt; &lt;a href="https://docs.docker.com/engine/install/ubuntu/" rel="noopener noreferrer"&gt;Docker Ubuntu Installation Guide&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Add Docker's Official GPG Key
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;ca-certificates curl
&lt;span class="nb"&gt;sudo install&lt;/span&gt; &lt;span class="nt"&gt;-m&lt;/span&gt; 0755 &lt;span class="nt"&gt;-d&lt;/span&gt; /etc/apt/keyrings
&lt;span class="nb"&gt;sudo &lt;/span&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://download.docker.com/linux/ubuntu/gpg &lt;span class="nt"&gt;-o&lt;/span&gt; /etc/apt/keyrings/docker.asc
&lt;span class="nb"&gt;sudo chmod &lt;/span&gt;a+r /etc/apt/keyrings/docker.asc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Add the Repository to Apt Sources
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo tee&lt;/span&gt; /etc/apt/sources.list.d/docker.sources &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; /etc/os-release &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;UBUNTU_CODENAME&lt;/span&gt;&lt;span class="k"&gt;:-&lt;/span&gt;&lt;span class="nv"&gt;$VERSION_CODENAME&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="sh"&gt;
Components: stable
Architectures: &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;dpkg &lt;span class="nt"&gt;--print-architecture&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="sh"&gt;
Signed-By: /etc/apt/keyrings/docker.asc
&lt;/span&gt;&lt;span class="no"&gt;EOF

&lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Install Docker Engine
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Verify Installation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Check if the Docker system service is active&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl status docker

&lt;span class="c"&gt;# Start Docker manually if it is not running&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start docker

&lt;span class="c"&gt;# Verify installed versions and system configurations&lt;/span&gt;
docker version
docker info
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Docker Command Reference
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Image Management&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker pull&lt;/code&gt;&lt;/strong&gt;: Download an image from a registry.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker pull [OPTIONS] IMAGE[:TAG|@DIGEST]&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker images&lt;/code&gt;&lt;/strong&gt;: List locally stored images.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker images [OPTIONS]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker images -q&lt;/code&gt; Lists only local image IDs&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker rmi&lt;/code&gt;&lt;/strong&gt;: Remove one or more local images.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker rmi [OPTIONS] IMAGE [IMAGE...]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker rmi -f myimage&lt;/code&gt; Forcefully removes the image &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker image prune&lt;/code&gt;&lt;/strong&gt;: Remove unused, dangling images to safely clear host disk space.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;&lt;code&gt;docker history&lt;/code&gt;&lt;/strong&gt;: Show the build history and layers of a specific image.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker history IMAGE&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;strong&gt;Container Lifecycle&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker ps&lt;/code&gt;&lt;/strong&gt;: List containers currently tracked by the engine.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker ps [OPTIONS]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker ps&lt;/code&gt; Shows active containers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example :&lt;/strong&gt; &lt;code&gt;docker ps -a&lt;/code&gt; Shows all containers, including stopped ones&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;&lt;code&gt;docker start&lt;/code&gt;&lt;/strong&gt;: Start one or more stopped containers.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker start [OPTIONS] CONTAINER [CONTAINER...]&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker stop&lt;/code&gt;&lt;/strong&gt;: Gracefully stop a running container.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker stop [OPTIONS] CONTAINER [CONTAINER...]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker stop -t 30 mycontainer&lt;/code&gt; Allows 30 seconds to stop gracefully before forcing termination&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker rm&lt;/code&gt;&lt;/strong&gt;: Remove one or more stopped containers from the host filesystem.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker rm [OPTIONS] CONTAINER [CONTAINER...]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker rm -f mycontainer&lt;/code&gt; Forcefully removes a running container&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker inspect&lt;/code&gt;&lt;/strong&gt;: Return low-level configuration and state information on Docker objects in raw JSON format.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker inspect [OPTIONS] OBJECT [OBJECT...]&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;strong&gt;Executing Commands &amp;amp; Interactivity&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker exec&lt;/code&gt;&lt;/strong&gt;: Run a new command process inside an actively running container.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker exec [OPTIONS] CONTAINER COMMAND [ARG...]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker exec -t my-container ls /app&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example (View File):&lt;/strong&gt; &lt;code&gt;docker exec -i mycontainer cat /etc/hostname&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker exec -it mycontainer /bin/bash&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker run&lt;/code&gt;&lt;/strong&gt;: Create and start a brand new container instance from a target image.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker run -it --rm --name cont3 ubuntu /bin/bash&lt;/code&gt;
automatically deletes the container’s ephemeral file layer as soon as it exits, keeping your host system clean.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;strong&gt;System Utilities&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker --help&lt;/code&gt;&lt;/strong&gt;: Displays help documentation, global options, and sub-commands for the Docker CLI.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  6. Dockerfile Authoring
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is a Dockerfile?
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;Dockerfile&lt;/strong&gt; is a text document containing all the sequential commands a user could call on the command line to assemble a Docker image.&lt;/p&gt;




&lt;h3&gt;
  
  
  Essential Dockerfile Instructions
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Instruction&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Function&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;FROM&lt;/code&gt;&lt;/strong&gt;:&lt;/td&gt;
&lt;td&gt;Sets the base image for subsequent instructions.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;RUN&lt;/code&gt;&lt;/strong&gt;:&lt;/td&gt;
&lt;td&gt;Executes commands in a new image layer and commits the results.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;CMD&lt;/code&gt;&lt;/strong&gt;:&lt;/td&gt;
&lt;td&gt;Specifies the default command to execute when the container starts.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;COPY&lt;/code&gt;&lt;/strong&gt;:&lt;/td&gt;
&lt;td&gt;Copies local files and directories from the host context into the filesystem of the image.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;WORKDIR&lt;/code&gt;&lt;/strong&gt;:&lt;/td&gt;
&lt;td&gt;Sets the working directory for any subsequent instructions.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;ENV&lt;/code&gt;&lt;/strong&gt;:&lt;/td&gt;
&lt;td&gt;Defines environment variables inside the container environment.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;LABEL&lt;/code&gt;&lt;/strong&gt;:&lt;/td&gt;
&lt;td&gt;Adds metadata key-value pairs to organize your images.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Image Layers &amp;amp; Building
&lt;/h3&gt;

&lt;p&gt;Each instruction in a Dockerfile maps directly to a read only Docker image layer.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker build&lt;/code&gt;&lt;/strong&gt;: Reads the Dockerfile instructions and builds the image layers.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker build [OPTIONS] PATH | URL | -&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker build -t myapp .&lt;/code&gt; Builds an image named myapp using the Dockerfile in the current directory&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Docker Image Layers Best Practice Tips
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Group Wisely&lt;/strong&gt;: Combine commands (like apt update &amp;amp;&amp;amp; apt install) to optimize layer caching performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Order Strategically&lt;/strong&gt;: Place less frequently changed instructions (such as dependency installation) early in the file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Minimize Size&lt;/strong&gt;: Avoid unnecessary RUN commands to reduce layer count and images size&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  7. Reference
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Official Documentation:&lt;/em&gt; &lt;a href="https://youtu.be/rjjES5IsPdg?si=l3lKvSKyvvWyqtq7" rel="noopener noreferrer"&gt;Learn Docker Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Official Reference:&lt;/em&gt; &lt;a href="https://docs.docker.com/engine/install/ubuntu/" rel="noopener noreferrer"&gt;Docker Ubuntu Installation Guide&lt;/a&gt;&lt;/p&gt;

</description>
      <category>basic</category>
      <category>dataengineering</category>
      <category>docker</category>
      <category>containers</category>
    </item>
    <item>
      <title>The Ultimate Docker Guide: Core Concepts &amp; Commands 🐳</title>
      <dc:creator>Hosea Mutwiri</dc:creator>
      <pubDate>Thu, 25 Jun 2026 15:42:41 +0000</pubDate>
      <link>https://dev.to/hoseamutwiri/the-ultimate-docker-guide-core-concepts-commands-36gf</link>
      <guid>https://dev.to/hoseamutwiri/the-ultimate-docker-guide-core-concepts-commands-36gf</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Docker Core Concepts&lt;/li&gt;
&lt;li&gt;Virtual Machines vs. Containers&lt;/li&gt;
&lt;li&gt;Docker Architecture&lt;/li&gt;
&lt;li&gt;Docker Installation on Linux&lt;/li&gt;
&lt;li&gt;Docker Command Reference&lt;/li&gt;
&lt;li&gt;Dockerfile Authoring&lt;/li&gt;
&lt;li&gt;Reference Documentation&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  1. Docker Core Concepts
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is a Container?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A container is a lightweight, isolated process running on a shared operating system kernel.&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/..." 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/..." alt="Uploading image" width="800" height="400"&gt;&lt;/a&gt; &lt;br&gt;
It is packaged with everything it needs to run, including code, libraries, environment variables, runtime, and configuration files.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features of Containers&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No Separate OS:&lt;/strong&gt; Shares the host operating system kernel directly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Isolated Environment:&lt;/strong&gt; Runs as a self-contained process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fast Lifecycle:&lt;/strong&gt; Quick to create, start, and tear down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repeatable:&lt;/strong&gt; Behaves identically across different environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Portable:&lt;/strong&gt; Works seamlessly on local laptops, VMs, or the cloud. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalable:&lt;/strong&gt; Easily multiplied to handle increased traffic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Container Engines&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To build, ship, and run containers, you need a container runtime engine installed&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Docker:&lt;/strong&gt; is the most popular container engine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Other Engines:&lt;/strong&gt; Linux Containers (LXC), containerd, and CRI-O.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Virtual Machines vs. Containers
&lt;/h2&gt;

&lt;p&gt;The structural divergence between Virtual Machines (VMs) and Containers defines their respective resource profiles and deployment speeds:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Virtual Machines (VMs)&lt;/th&gt;
&lt;th&gt;Containers&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Architecture&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Runs via a Hypervisor.&lt;/td&gt;
&lt;td&gt;Shares the host OS kernel.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Weight&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Heavyweight&lt;/td&gt;
&lt;td&gt;Lightweight&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scalability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Slow boot times&lt;/td&gt;
&lt;td&gt;Near-zero startup times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Portability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Bound to hypervisor standards&lt;/td&gt;
&lt;td&gt;Highly portable across any OS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;OS Overhead&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Redundant guest OS overhead&lt;/td&gt;
&lt;td&gt;Shares the host OS kernel&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Image Management&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Inefficient image management&lt;/td&gt;
&lt;td&gt;Efficient, layered image management&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  3. Docker Architecture
&lt;/h2&gt;

&lt;p&gt;Docker uses a client-server architecture to simplify building, running, managing, and distributing applications. It is an open-source platform developed by Docker Inc.&lt;br&gt;
&lt;strong&gt;Architectural Components&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Docker Client:&lt;/strong&gt; The primary interface (docker CLI) that enables users to interact with Docker by sending commands.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Host:&lt;/strong&gt; The physical server or Virtual Machine (VM) on which the Docker engine is installed and running.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Daemon (dockerd):&lt;/strong&gt; The heart of Docker. It listens for Docker API requests from the client and manages containers, images, networks, and volumes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Images:&lt;/strong&gt; Read-only binary templates containing the application and its dependencies used to build containers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Containers:&lt;/strong&gt; The encapsulated, runnable instances of a Docker image where applications actually execute.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Registries:&lt;/strong&gt; Storage repositories used to hold and share Docker images (e.g., Docker Hub).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. Docker Installation on Linux
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Official Reference:&lt;/em&gt; &lt;a href="https://docs.docker.com/engine/install/ubuntu/" rel="noopener noreferrer"&gt;Docker Ubuntu Installation Guide&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Add Docker's Official GPG Key
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;ca-certificates curl
&lt;span class="nb"&gt;sudo install&lt;/span&gt; &lt;span class="nt"&gt;-m&lt;/span&gt; 0755 &lt;span class="nt"&gt;-d&lt;/span&gt; /etc/apt/keyrings
&lt;span class="nb"&gt;sudo &lt;/span&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://download.docker.com/linux/ubuntu/gpg &lt;span class="nt"&gt;-o&lt;/span&gt; /etc/apt/keyrings/docker.asc
&lt;span class="nb"&gt;sudo chmod &lt;/span&gt;a+r /etc/apt/keyrings/docker.asc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Add the Repository to Apt Sources
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo tee&lt;/span&gt; /etc/apt/sources.list.d/docker.sources &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; /etc/os-release &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;UBUNTU_CODENAME&lt;/span&gt;&lt;span class="k"&gt;:-&lt;/span&gt;&lt;span class="nv"&gt;$VERSION_CODENAME&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="sh"&gt;
Components: stable
Architectures: &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;dpkg &lt;span class="nt"&gt;--print-architecture&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="sh"&gt;
Signed-By: /etc/apt/keyrings/docker.asc
&lt;/span&gt;&lt;span class="no"&gt;EOF

&lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Install Docker Engine
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Verify Installation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Check if the Docker system service is active&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl status docker

&lt;span class="c"&gt;# Start Docker manually if it is not running&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start docker

&lt;span class="c"&gt;# Verify installed versions and system configurations&lt;/span&gt;
docker version
docker info
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Docker Command Reference
Here is your content naturally enhanced and formatted into a clean, professional Markdown section. I have standardized the syntax formatting, added brief explanations for common flags, and organized the sub-sections into a more readable layout.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  5. Docker Command Reference
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Image Management&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker pull&lt;/code&gt;&lt;/strong&gt;: Download an image from a registry.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker pull [OPTIONS] IMAGE[:TAG|@DIGEST]&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker images&lt;/code&gt;&lt;/strong&gt;: List locally stored images.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker images [OPTIONS]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker images -q&lt;/code&gt; Lists only local image IDs&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker rmi&lt;/code&gt;&lt;/strong&gt;: Remove one or more local images.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker rmi [OPTIONS] IMAGE [IMAGE...]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker rmi -f myimage&lt;/code&gt; Forcefully removes the image &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker image prune&lt;/code&gt;&lt;/strong&gt;: Remove unused, dangling images to safely clear host disk space.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;&lt;code&gt;docker history&lt;/code&gt;&lt;/strong&gt;: Show the build history and layers of a specific image.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker history IMAGE&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;strong&gt;Container Lifecycle&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker ps&lt;/code&gt;&lt;/strong&gt;: List containers currently tracked by the engine.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker ps [OPTIONS]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker ps&lt;/code&gt; Shows active containers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example :&lt;/strong&gt; &lt;code&gt;docker ps -a&lt;/code&gt; Shows all containers, including stopped ones&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;&lt;code&gt;docker start&lt;/code&gt;&lt;/strong&gt;: Start one or more stopped containers.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker start [OPTIONS] CONTAINER [CONTAINER...]&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker stop&lt;/code&gt;&lt;/strong&gt;: Gracefully stop a running container.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker stop [OPTIONS] CONTAINER [CONTAINER...]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker stop -t 30 mycontainer&lt;/code&gt; Allows 30 seconds to stop gracefully before forcing termination&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker rm&lt;/code&gt;&lt;/strong&gt;: Remove one or more stopped containers from the host filesystem.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker rm [OPTIONS] CONTAINER [CONTAINER...]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker rm -f mycontainer&lt;/code&gt; Forcefully removes a running container&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker inspect&lt;/code&gt;&lt;/strong&gt;: Return low-level configuration and state information on Docker objects in raw JSON format.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker inspect [OPTIONS] OBJECT [OBJECT...]&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;strong&gt;Executing Commands &amp;amp; Interactivity&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker exec&lt;/code&gt;&lt;/strong&gt;: Run a new command process inside an actively running container.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker exec [OPTIONS] CONTAINER COMMAND [ARG...]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker exec -t my-container ls /app&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example (View File):&lt;/strong&gt; &lt;code&gt;docker exec -i mycontainer cat /etc/hostname&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker exec -it mycontainer /bin/bash&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker run&lt;/code&gt;&lt;/strong&gt;: Create and start a brand new container instance from a target image.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker run -it --rm --name cont3 ubuntu /bin/bash&lt;/code&gt;
automatically deletes the container’s ephemeral file layer as soon as it exits, keeping your host system clean.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;strong&gt;System Utilities&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker --help&lt;/code&gt;&lt;/strong&gt;: Displays help documentation, global options, and sub-commands for the Docker CLI.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  6. Dockerfile Authoring
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is a Dockerfile?
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;Dockerfile&lt;/strong&gt; is a text document containing all the sequential commands a user could call on the command line to assemble a Docker image.&lt;/p&gt;




&lt;h3&gt;
  
  
  Essential Dockerfile Instructions
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Instruction&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Function&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;FROM&lt;/code&gt;&lt;/strong&gt;:&lt;/td&gt;
&lt;td&gt;Sets the base image for subsequent instructions.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;RUN&lt;/code&gt;&lt;/strong&gt;:&lt;/td&gt;
&lt;td&gt;Executes commands in a new image layer and commits the results.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;CMD&lt;/code&gt;&lt;/strong&gt;:&lt;/td&gt;
&lt;td&gt;Specifies the default command to execute when the container starts.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;COPY&lt;/code&gt;&lt;/strong&gt;:&lt;/td&gt;
&lt;td&gt;Copies local files and directories from the host context into the filesystem of the image.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;WORKDIR&lt;/code&gt;&lt;/strong&gt;:&lt;/td&gt;
&lt;td&gt;Sets the working directory for any subsequent instructions.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;ENV&lt;/code&gt;&lt;/strong&gt;:&lt;/td&gt;
&lt;td&gt;Defines environment variables inside the container environment.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;LABEL&lt;/code&gt;&lt;/strong&gt;:&lt;/td&gt;
&lt;td&gt;Adds metadata key-value pairs to organize your images.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Image Layers &amp;amp; Building
&lt;/h3&gt;

&lt;p&gt;Each instruction in a Dockerfile maps directly to a read only Docker image layer.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker build&lt;/code&gt;&lt;/strong&gt;: Reads the Dockerfile instructions and builds the image layers.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt; &lt;code&gt;docker build [OPTIONS] PATH | URL | -&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;docker build -t myapp .&lt;/code&gt; Builds an image named myapp using the Dockerfile in the current directory&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Docker Image Layers Best Practice Tips
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Group Wisely&lt;/strong&gt;: Combine commands (like apt update &amp;amp;&amp;amp; apt install) to optimize layer caching performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Order Strategically&lt;/strong&gt;: Place less frequently changed instructions (such as dependency installation) early in the file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Minimize Size&lt;/strong&gt;: Avoid unnecessary RUN commands to reduce layer count and images size&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  7. Reference
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Official Documentation:&lt;/em&gt; &lt;a href="https://youtu.be/rjjES5IsPdg?si=l3lKvSKyvvWyqtq7" rel="noopener noreferrer"&gt;Learn Docker Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Official Reference:&lt;/em&gt; &lt;a href="https://docs.docker.com/engine/install/ubuntu/" rel="noopener noreferrer"&gt;Docker Ubuntu Installation Guide&lt;/a&gt;&lt;/p&gt;

</description>
      <category>basic</category>
      <category>dataengineering</category>
      <category>docker</category>
      <category>containers</category>
    </item>
    <item>
      <title>How Linux Is Used in Real-World Data Engineering</title>
      <dc:creator>Hosea Mutwiri</dc:creator>
      <pubDate>Sun, 29 Mar 2026 23:44:48 +0000</pubDate>
      <link>https://dev.to/hoseamutwiri/how-linux-is-used-in-real-world-data-engineering-2f3m</link>
      <guid>https://dev.to/hoseamutwiri/how-linux-is-used-in-real-world-data-engineering-2f3m</guid>
      <description>&lt;p&gt;If you’re just getting started in data engineering, you’ll hear one word again and again: &lt;strong&gt;Linux&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this beginner friendly guide, you’ll learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What Linux is&lt;/li&gt;
&lt;li&gt;A quick history of Linux&lt;/li&gt;
&lt;li&gt;Why data engineers rely on it&lt;/li&gt;
&lt;li&gt;The Linux commands worth learning first&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What is Linux?
&lt;/h3&gt;

&lt;p&gt;Linux is an operating system, like Windows or macOS. An operating system manages your machine’s hardware (CPU, memory, storage, networking) and provides the foundation that applications run on. Without an operating system, your computer or server cannot do much at all.&lt;/p&gt;

&lt;p&gt;A complete Linux system typically includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bootloader - Loads the operating system when the machine starts&lt;/li&gt;
&lt;li&gt;Kernel - The core component that manages hardware and system resources&lt;/li&gt;
&lt;li&gt;Init system - Starts and supervises services&lt;/li&gt;
&lt;li&gt;Daemons - Background processes (for example, logging, scheduling, and networking)&lt;/li&gt;
&lt;li&gt;Graphical server - Powers a desktop interface&lt;/li&gt;
&lt;li&gt;Desktop environment and applications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Linux is free and open source, which means anyone can view, modify, and share the code. It comes in many versions called distributions (or “distros”), each tuned for different needs. If you want to explore what’s out there, &lt;a href="https://distrowatch.com/" rel="noopener noreferrer"&gt;DistroWatch&lt;/a&gt; is a good place to browse.&lt;/p&gt;

&lt;h3&gt;
  
  
  Brief history of Linux
&lt;/h3&gt;

&lt;p&gt;In 1991, Finnish student Linus Torvalds started building Linux as a personal project while studying at the University of Helsinki. At the time, he was frustrated by the limitations of MINIX, a small Unix like teaching system, and wanted a free alternative.&lt;/p&gt;

&lt;p&gt;Torvalds released the first version of the Linux kernel that year. In parallel, Richard Stallman and the Free Software Foundation (FSF) were developing the GNU project, which provided many of the tools and utilities people use in a Unix-like system.&lt;/p&gt;

&lt;p&gt;Together, the Linux kernel and GNU tools formed the complete system many people refer to as GNU/Linux. What began as a hobby project grew into a global collaboration and now powers much of the world’s servers, cloud platforms and embedded devices.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why do data engineers use Linux?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Data engineering&lt;/strong&gt; is about building and maintaining pipelines that move data from raw sources into clean, reliable datasets for analysts and data scientists and most of that work happens on servers, and Linux dominates the server world.&lt;/p&gt;

&lt;p&gt;Here’s why it matters so much:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Automation&lt;/strong&gt;
Data pipelines depend on scripting, scheduling, and file processing. With command line and tools like &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;awk&lt;/code&gt;, &lt;code&gt;sed&lt;/code&gt;, and &lt;code&gt;find&lt;/code&gt;, plus job scheduling with &lt;strong&gt;&lt;code&gt;cron&lt;/code&gt;&lt;/strong&gt;. You can automate ETL runs, backups and routine maintenance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stability and performance&lt;/strong&gt;
Linux systems are known for running reliably for long periods. That matters when pipelines need to work 24/7 and process large volumes of data without interruptions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security&lt;/strong&gt;
Linux system can run continuously for years without reboots hence efficiency in data processing pipelines that need to run 24/7 without interruptions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compatibility and ecosystem&lt;/strong&gt;
Many core data tools are built for Linux or run best on it, including Apache Spark, Kafka, Airflow, Hadoop, Docker, Kubernetes, PostgreSQL, and most cloud services (AWS, GCP, Azure).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Basic Linux commands every data engineer should learn first
&lt;/h3&gt;

&lt;p&gt;Here are the most useful beginner commands, grouped by category.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Directory navigation&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt; &lt;span class="c"&gt;# Print the current working directory&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;path] &lt;span class="c"&gt;# Change directory&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; .. &lt;span class="c"&gt;# Go up one level&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~ &lt;span class="c"&gt;# Go to your home directory&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;File and directory management&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="c"&gt;# List files in the current directory&lt;/span&gt;
&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; &lt;span class="c"&gt;# Detailed list (permissions, owner, size, date)&lt;/span&gt;
&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; &lt;span class="c"&gt;# Show all files, including hidden ones&lt;/span&gt;
&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-lh&lt;/span&gt; &lt;span class="c"&gt;# Human readable file sizes&lt;/span&gt;
&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;name] &lt;span class="c"&gt;# Create a new directory&lt;/span&gt;
&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;parent/child] &lt;span class="c"&gt;# Create nested directories&lt;/span&gt;
&lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;source&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;destination] &lt;span class="c"&gt;# Copy files or directories (use -r for recursive)&lt;/span&gt;
&lt;span class="nb"&gt;mv&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;source&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;destination] &lt;span class="c"&gt;# Move or rename files or directories&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;file] &lt;span class="c"&gt;# Remove a file (use -r for directories)&lt;/span&gt;
&lt;span class="nb"&gt;rmdir&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;directory] &lt;span class="c"&gt;# Remove an empty directory&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Viewing and searching content&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;file] &lt;span class="c"&gt;# Print the file contents (best for small files)&lt;/span&gt;
&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;file] &lt;span class="c"&gt;# Print with line numbers&lt;/span&gt;
&lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;file] &lt;span class="c"&gt;# Show the first 10 lines (handy for checking CSV headers)&lt;/span&gt;
&lt;span class="nb"&gt;tail&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;file] &lt;span class="c"&gt;# Show the last 10 lines (use -f to follow logs in real time)&lt;/span&gt;
&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s2"&gt;"string"&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;file] &lt;span class="c"&gt;# Search for a string in a file&lt;/span&gt;
&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s2"&gt;"string"&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;file] &lt;span class="c"&gt;# Case-insensitive search&lt;/span&gt;
&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"string"&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;file] &lt;span class="c"&gt;# Show matching line numbers&lt;/span&gt;
&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"string"&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;file] &lt;span class="c"&gt;# Count matching lines&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Other useful commands&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"text"&lt;/span&gt; &lt;span class="c"&gt;# Print text (useful for debugging scripts)&lt;/span&gt;
clear &lt;span class="c"&gt;# Clear the terminal screen&lt;/span&gt;
find &lt;span class="o"&gt;[&lt;/span&gt;path] &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"*.csv"&lt;/span&gt; &lt;span class="c"&gt;# Find files by name&lt;/span&gt;
&lt;span class="nb"&gt;wc&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;file] &lt;span class="c"&gt;# Count lines, words, and characters&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;As someone who has just started learning data engineering (currently in week 3), it’s already clear how central Linux is to real world data work.&lt;br&gt;
This article was my attempt to explain the basics: what Linux is, its history, why it matters, and the essential commands every beginner should learn.&lt;br&gt;
I still have a long way to go, but practicing these commands has already boosted my confidence. &lt;br&gt;
Thanks for reading! I would like to hear your tips for beginners in the comments.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>linux</category>
      <category>data</category>
      <category>dataengineering</category>
    </item>
  </channel>
</rss>
