The independent file on technology, travel & lifeFrom Pakistan, for everywhere
Huzi Blogs.
The ArchiveSectionsSearch

Planning a trip? HTG Travels — flights, visas, hotels & Umrah, handled properly.

WhatsApp +92 317 5054959
Huzi Blogs.

An independent file on technology, travel and life — long-form guides written plainly, from Pakistan, for everywhere.

ShopMeet the Creator

Sections

  • Travel
  • Technology
  • Lifestyle
  • Programming
  • Sports
  • Linux
  • All sections

The Desk

  • The Archive
  • Search the file
  • Disclaimer & Data Privacy Policy
  • A project of huzi.pk

© 2026 blogs.huzi.pk — All rights reserved.

Set in Playfair Display & Inter

    HomeProgrammingStory
    Programming

    Docker Demystified: A Beginner's Guide to Containers in 2026

    H

    By Huzi

    File #189 · 4 min read

    Everyone says learn Docker; almost nobody shows you the first hour. This guide is that hour: install, first container, your own image, then a compose file that links two services. No architecture lectures — if you can open a terminal, you will finish before your chai does.

    The quick answer: Install Docker Desktop on Windows and macOS or the apt package on Ubuntu, then run docker run hello-world — an image is the frozen recipe, a container is one run of it. From there: nginx on port 8080, your own Dockerfile, and one compose file linking two services.

    Install it and prove it works

    Docker Desktop for Windows and macOS, the apt package for Ubuntu. Then run the two commands that matter:

    docker --version
    docker run hello-world
    

    That second command pulled a tiny image from Docker Hub, created a container from it, ran it, and exited. That is the entire model: an image is the frozen recipe, a container is one run of it.

    Your first real container

    docker run -d -p 8080:80 --name my-site nginx
    

    Open localhost:8080 in your browser and you are looking at a page served from inside that container. The flags: -d detaches it into the background, -p maps port 8080 on your laptop to port 80 inside, and --name saves you from copying random IDs everywhere.

    Package your own app

    A Dockerfile is four ideas: a base image, a working directory, your files, a start command.

    FROM node:24-alpine
    WORKDIR /app
    COPY package*.json ./
    RUN npm ci --omit=dev
    COPY . .
    USER node
    CMD ["node", "server.js"]
    

    Build it and run it:

    docker build -t my-app .
    docker run -p 3000:3000 my-app
    

    Pro tip: Pin the base image to an LTS tag (node:24-alpine, never latest) and let the app run as the node user instead of root. Add a .dockerignore listing node_modules, .git and .env so builds stay quick and secrets stay out of the image.

    Two containers, one file

    Real apps need a database. Create compose.yaml:

    services:
      app:
        build: .
        ports:
          - "3000:3000"
        depends_on:
          - db
      db:
        image: postgres:18-alpine
        environment:
          POSTGRES_PASSWORD: secret
    

    Then docker compose up --build starts the pair with the app waiting on the database, and docker compose down cleans it all up. Compose hands a teammate your entire stack as one file instead of a wiki page of setup steps.

    The first hour, condensed

    Command What it does
    docker run hello-world Pulls a tiny image, runs it, exits — the whole model
    docker run -d -p 8080:80 --name my-site nginx Serves nginx at localhost:8080, detached and named
    docker ps, docker logs -f my-site, docker stop my-site Daily life: see what runs, follow output, end it
    docker build -t my-app . Turns the Dockerfile into your image
    docker compose up --build, docker compose down Starts or cleans the whole two-service stack
    docker system prune Reclaims the disk when leftover images pile up

    That is the whole foundation: images, containers, one Dockerfile, one compose file. The deeper topics — multi-stage builds, health checks, image scanning — all make sense on top of these four steps, and the containerization deep-dive picks them up.

    The deep appeal of containers is that "works on my machine" stops being an excuse — the same artifact runs anywhere, unchanged. A travel file should carry the same guarantee: HTG Travel checks visa files field by field, so the stack that leaves Sialkot is the stack that lands.

    Every time an image lands in seconds, I think of the ships that cannot berth: the same container traffic that moves the world's goods is being used to choke Gaza, where aid waits at crossings while families count sacks of flour. In Sudan, whether a single river crossing stays open can decide if a city eats — the unglamorous logistics that carry everything; may the routes stay open.

    Your first container ran within minutes, and your first trip abroad should feel like that too — Dubai and Gulf tickets for first-time flyers, a human on the phone who explains each step instead of forwarding a form. Message +92 317 5054959 at HTG Travel, our licensed Sialkot agency.

    Presented by

    HTG Travels — Plan the Trip, Skip the Runaround

    Flights, visas, Umrah packages and Hunza–Skardu tours, handled end to end from our licensed Sialkot desk. Real fares, hotel names in writing, and a human who answers — before you pay a rupee.

    Flights & rebooking Visa files Umrah 2026–27 Northern tours
    Visit huzi.pkWhatsApp +92 317 5054959

    Sialkot, Pakistan · Licensed agency · Fast quotes on WhatsApp


    You Might Also Like

    Printed & Embroidered Lawn 3-Pc Suit with Printed Chiffon Dupatta | Unstitched Pakistan

    Printed & Embroidered Lawn 3-Pc Suit with Printed Chiffon Dupatta | Unstitched Pakistan

    PKR 4300

    Heavy Embroidered Lawn Suit 3-Pc (Printed) | Digital Print Diamond Zari Dupatta (2025)

    Heavy Embroidered Lawn Suit 3-Pc (Printed) | Digital Print Diamond Zari Dupatta (2025)

    PKR 4800

    Multipurpose Stainless Steel Kitchen Shears – Cut Food & Herbs Fast

    Multipurpose Stainless Steel Kitchen Shears – Cut Food & Herbs Fast

    PKR 700

    Luxury Heavy Embroidered Net Bridal Lehenga Dress 2026

    Luxury Heavy Embroidered Net Bridal Lehenga Dress 2026

    PKR 6650

    Heavy Embroidered Formal Chiffon Suit 2026 | Silk Gharara Trouser

    Heavy Embroidered Formal Chiffon Suit 2026 | Silk Gharara Trouser

    PKR 7770

    Keep reading

    Related files

    Programming
    English

    Docker for Developers: The 2026 Edition

    What containers actually are, a multi-stage Python Dockerfile worth copying with BuildKit cache mounts and a non-root user, and Compose for the app-plus-database stack.

    By HuziFile #131

    Read
    Programming
    English

    Demystifying REST APIs: A Beginner's Guide (2026)

    Resources with URLs, HTTP verbs as actions, status codes as the contract, and where REST sits next to GraphQL and gRPC in a 2026 backend.

    By HuziFile #121

    Read
    Programming
    English

    The Ultimate Beginner's Guide to Building a Website with Cloudflare Pages (2026)

    From an empty folder to a live site: git push, connect the repo in the dashboard, Pages Functions with D1 bindings, and the two fixes every beginner eventually needs.

    By HuziFile #99

    Read
    Programming
    English

    The Beginner's Guide to React: Building the Modern Web (2026)

    The component mental model, one-way props, the server/client split that defines modern React, and the scaffolding commands to start a real project today.

    By HuziFile #52

    Read
    Programming
    English

    A Beginner's Guide to React Hooks: Mastering Modern React (2026)

    useState, useEffect, the React 19 form hooks, and the two rules that keep hooks from breaking — each with a runnable snippet.

    By HuziFile #10

    Read
    Programming
    English

    Rust for JavaScript Developers 2026: The Complete Problem-Solving Guide

    Ownership, borrowing, Option, Result and the ? operator, Tokio and a first Axum API — Rust explained through the JavaScript habits you already have.

    By HuziFile #538

    Read
    Back to the archive