By Muhammad Usman Khan, Lead Cloud Instructor at Sherdil E-Learning

Published: 19 May 2026    |   Last updated: 19 May 2026

If you are a developer or IT professional in Pakistan looking for a practical Docker tutorial, this guide walks you through everything you need to know to go from zero containers to a working Dockerfile. Docker has changed how modern applications are built, shipped, and deployed, and it is now a baseline skill for almost every DevOps and backend role in the country.

This guide is written for Pakistani developers new to containerisation. We cover what Docker is, why it matters for your career, how to install it on Windows, Ubuntu, and macOS, the core concepts you need to know, hands-on commands you can run today, your first Dockerfile, and where Docker fits into the DevOps career path.


What is Docker?

You build a web application on your laptop. It runs fine. Your teammate pulls the code on their machine, and it crashes. The reason is almost always environment differences, different Node versions, missing system libraries, or a Python module installed globally on your machine but not theirs.

Docker solves this by packaging your application along with everything it needs, code, runtime, system tools, libraries, and settings, into a single isolated unit called a container. The container runs identically on any machine that has Docker installed: your laptop, a teammate’s laptop, a CI runner, a production server, or a cloud platform.

The shorter version: a virtual machine ships a whole operating system per application; Docker ships just the application and its dependencies, with the host operating system shared underneath. That difference makes containers start in seconds rather than minutes and weigh megabytes rather than gigabytes.


Why Pakistani developers should learn Docker in 2026

Docker is one of the highest-return skills a Pakistani developer can pick up in 2026 for four practical reasons.

It is now a near-default requirement in DevOps and backend job listings. Reviewing Q1 2026 listings on Rozee.pk and LinkedIn Pakistan, roughly two-thirds of DevOps roles and over half of backend developer roles list Docker as a required or preferred skill, and companies will often filter resumes by it.

On the freelance side, Docker work pays well. Containerising legacy applications, setting up CI/CD pipelines, and refactoring monoliths into microservices are typical projects on Upwork and Fiverr that pay $25 to $60 per hour for certified Pakistani engineers in 2026.

Docker is also a prerequisite for the major cloud platforms. AWS ECS, Azure Container Instances, and Google Cloud Run all run Docker containers under the hood, so any production cloud work eventually requires Docker fluency.

Finally, you cannot meaningfully learn Kubernetes without Docker first. Kubernetes orchestrates Docker containers; every cluster you deploy on is running images you built and pushed to a registry. Docker is step one of the modern DevOps career path.


Docker vs virtual machines: key differences

The clearest way to understand what Docker is doing is to compare it to the older approach: virtual machines.

Feature

Docker container

Virtual machine

Startup time

Seconds

Minutes

Size

50–500 MB

5–20 GB

Operating system

Shares the host kernel

Full OS per VM

Performance

Near-native speed

Slower (hypervisor overhead)

Isolation

Process-level

Hardware-level

Portability

Runs anywhere Docker runs

Tied to the hypervisor

Typical use case

Microservices, CI/CD, dev environments

Legacy apps, full OS isolation

Resource footprint

Lightweight, run dozens

Heavy, run a few


Core Docker concepts you need to know

Five terms come up constantly in Docker work. Get comfortable with these, and the rest of the ecosystem makes sense.

Docker image

A read-only template that contains everything needed to run an application: the code, runtime, libraries, environment variables, and configuration files. Images are built from instructions in a Dockerfile and stored on your machine or in a registry like Docker Hub.

Docker container

A running instance of an image. When you run an image, Docker creates a container from it. You can start, stop, restart, and delete containers without affecting the underlying image. Multiple containers can run from the same image.

Dockerfile

A plain text file with step-by-step instructions for building an image. It specifies the base image (for example, Ubuntu or Node.js), the commands to install dependencies, the files to copy in, and the command to run when the container starts.

Docker Hub

Docker Hub is the largest public registry of Docker images. It hosts official images for Node.js, Python, MySQL, Nginx, Redis, and almost every other common piece of infrastructure. You can pull these as base images and build on top of them.

Docker Compose

A tool for defining and running multi-container applications. Instead of running each container manually, you create a docker-compose.yml file that defines all the containers (web server, database, cache, etc.), their relationships, and their networks. One command, docker compose up, starts everything.


Installing Docker, step by step

Windows

Download Docker Desktop from the official site:

docker.com/products/docker-desktop

Run the installer and enable WSL 2 (Windows Subsystem for Linux) when prompted. Restart your computer after installation, then open Command Prompt or PowerShell and check the install:

docker --version

You should see Docker version 28 or newer. If you see a version number, Docker is installed correctly.

Ubuntu (using the official Docker apt repository)

The Ubuntu-packaged docker.io is often a major version behind. The current best practice is to install from the official Docker apt repository:

sudo apt-get update
 sudo apt-get install -y ca-certificates curl
 sudo install -m 0755 -d /etc/apt/keyrings
 sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
     -o /etc/apt/keyrings/docker.asc
 sudo chmod a+r /etc/apt/keyrings/docker.asc
 
 echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \
      https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo \"$VERSION_CODENAME\") stable" | \
     sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
 
 sudo apt-get update
 sudo apt-get install -y docker-ce docker-ce-cli containerd.io \
     docker-buildx-plugin docker-compose-plugin
 
 sudo systemctl enable --now docker
 docker --version

For full reference and other Linux distributions, see the official Docker Engine install guide.

macOS

Download Docker Desktop for Mac from docker.com and drag it into your Applications folder. Open Docker Desktop, grant the required permissions, and confirm the install with docker --version. On Apple Silicon Macs, Docker Desktop runs natively on ARM64.


Your first Docker container: hands-on tutorial

Open a terminal and run your first container:

docker run hello-world

Docker pulls the hello-world image from Docker Hub and runs it. You will see a message confirming the install is working.

Now run something more useful, an Nginx web server:

docker run -d -p 8080:80 --name my-web-server nginx

Breaking down the flags: -d runs the container in the background (detached mode); -p 8080:80 maps port 8080 on your machine to port 80 inside the container; --name gives the container a readable name; nginx is the image to run. Open http://localhost:8080 in a browser, and you should see the Nginx welcome page.

Useful follow-up commands:

# list running containers
 docker ps
 
 # stop the container
 docker stop my-web-server
 
 # remove the container
 docker rm my-web-server

Writing your first Dockerfile

Create a simple Node.js application and containerise it. In a new directory, create a file named Dockerfile (no extension) with this content:

FROM node:22-alpine
 WORKDIR /app
 COPY package*.json ./
 RUN npm install
 COPY . .
 EXPOSE 3000
 CMD ["node", "app.js"]

Reading the Dockerfile line by line:

  • FROM node:22-alpine, start from the official Node.js 22 image, Alpine variant for small size.
  • WORKDIR /app, set the working directory inside the container to /app.
  • COPY package*.json ./, copy package.json and package-lock.json into the container first (for layer caching).
  • RUN npm install, install dependencies inside the container.
  • COPY. ., copy the rest of the application source.
  • EXPOSE 3000, declare the port the container listens on.
  • CMD ["node", "app.js"] is the command Docker runs when the container starts.

Build and run the image:

docker build -t my-node-app .
 docker run -d -p 3000:3000 --name my-app my-node-app

Full reference: Dockerfile reference on docs.docker.com.


Docker in the real world: how Pakistani teams use it

The four most common ways Pakistani developers and freelancers use Docker today, based on what our Sherdil cohorts and clients report.

For e-commerce and marketplace applications, teams run separate containers for the web frontend, the API backend, the database, and the cache layer (Redis). Docker Compose wires them together, and the same compose file works for local development, staging, and production with only environment-variable changes.

For freelance projects, delivering work as a Dockerized package, a docker-compose.yml plus a README, means the international client runs one command (docker compose up) and has your entire application working. This is a major differentiator on Upwork; we have seen Pakistani freelancers win contracts specifically because their deliverable was a one-command Docker bundle rather than a tarball with a setup README.

Pakistani software houses commonly use Docker to keep development, testing, and production environments identical, which removes a large category of "works on my machine" bugs from the QA cycle.

And for cloud deployments, AWS ECS, Azure Container Instances, and Google Cloud Run all accept Docker images directly. The image you build locally is the same image you push to production.

To deploy Docker containers on AWS, see Sherdil’s AWS 3-in-1 Training Bundle, which covers ECS deployment alongside Cloud Practitioner and Solutions Architect content.


Docker commands cheat sheet

The commands you will use almost daily once you start building images.

Command

What it does

docker pull <image>

Download an image from Docker Hub

docker run <image>

Create and start a new container

docker ps

List running containers

docker ps -a

List all containers (including stopped)

docker stop <name>

Stop a running container

docker rm <name>

Delete a stopped container

docker images

List downloaded images

docker rmi <image>

Delete an image

docker build -t <name>.

Build an image from a Dockerfile in the current directory

docker compose up

Start all services defined in docker-compose.yml

docker exec -it <name> bash

Open a shell inside a running container

docker logs <name>

View a container’s stdout/stderr

 Full command reference: Docker CLI reference on docs.docker.com.


Frequently asked questions

Is Docker free to use?

Docker Engine is open-source and completely free. Docker Desktop is free for personal use, education, and small businesses (under 250 employees and under $10 million annual revenue). Larger commercial use requires a paid Docker subscription.

Can I learn Docker without knowing Linux?

Basic Linux command-line familiarity is strongly advised. Most containers run Linux internally, and Docker commands are executed in a terminal. You do not need to be a Linux expert; comfort with cd, ls, mkdir, cat, grep, and a text editor like nano or vim is enough to start.

How long does it take to learn Docker?

The basics (images, containers, Dockerfiles, Docker Compose) take two to three weeks with daily practice. Becoming proficient enough for a junior DevOps role typically takes two to three months, including hands-on projects.

Should I learn Docker or Kubernetes first?

Always Docker first. Kubernetes orchestrates Docker containers, so you need to understand containers before you can orchestrate them. A reasonable progression: one to two months on Docker, then four to six weeks on Kubernetes.

What is the difference between docker run and docker compose up?

docker run starts a single container. docker compose up starts everything defined in a docker-compose.yml file, typically multiple containers (web, API, database, cache) wired together with networks and shared volumes. Use docker run for quick tests and individual services; use Compose for any real application.

Can I use Docker on Windows without WSL 2?

Modern Docker Desktop on Windows requires WSL 2 (or Hyper-V) for its backend. WSL 2 is the recommended setup and works out of the box on Windows 10 (build 19041+) and Windows 11. There is no production-grade native Windows containers experience aimed at typical developer workloads.


Next steps: from Docker to a DevOps career

Docker is the first major skill on the DevOps roadmap. After you are comfortable building and running containers, the natural progression is Kubernetes (container orchestration), Terraform (infrastructure as code), and one cloud platform (AWS is the most common starting point in Pakistan).

For a structured Urdu-language path, the DevOps Engineer Course at Sherdil E-Learning covers Docker in depth, then takes you through Kubernetes, CI/CD, AWS, and Terraform. For a complete picture of where Docker fits into a Pakistani DevOps career, read our DevOps career roadmap for Pakistan.


Related guides

AWS vs Azure vs GCP: which cloud certification should you get first?

Best free cloud computing courses in Urdu (2026)

 

About the author

Muhammad Usman is a Lead Cloud Instructor at Sherdil E-Learning, holding the Alibaba Cloud ACP certification along with AWS and Azure credentials. He is an expert trainer in AWS and Google Cloud, having delivered 1,500+ hours of training across 12+ countries and completed 50+ multi-cloud projects. Passionate about transforming technical expertise into real-world success, he helps professionals and organisations build strong cloud and DevOps capabilities.