DevOps and Cloud Computing

Docker for Developers: A Quick Guide

A quick developer-focused guide to Docker concepts, commands, images, containers, and good practices.

Ahmed Oumezzine Ahmed Oumezzine 6 min read
  • Table of contents unavailable
Docker for Developers: A Quick Guide

Introduction

"Wait… Docker is still complicated, right? I’m lost between images, containers, and Dockerfiles…"
— You, five minutes ago.

Do not worry. We are going to untangle all of this together. No unnecessary jargon. No stress. Just enough for you to launch your first container today — and understand why Docker can become one of your most useful development tools.

Who Is This Guide For?

For you: a motivated beginner, someone transitioning into tech, or a passionate student who wants to understand the tools developers use every day.

You want to learn independently without drowning in hundreds of pages of documentation.

You want to become a developer or simply work more efficiently on your projects.

And you are looking for a practical learning path that takes you from zero to actually running something — quickly and without unnecessary complexity.

So let’s get started.

What Exactly Is Docker — and Why Should You Learn It?

Imagine you want to send an application to a colleague.

You tell them: "Install Node.js, install these dependencies, configure the database…"

And then… surprise: it does not work on their machine.

Why? Because their environment is not exactly the same as yours.

🎯 Classic problem: "It works on my machine."

Now imagine being able to package your application together with the environment and dependencies it needs.

Then you can run that package consistently on your computer, a colleague’s machine, a server, or a cloud environment that supports containers.

👉 That is the core idea behind Docker.

💡 Think of Docker as a container system for your application.
You package the application into an image, start a container from it, and run it in a controlled environment.

Unlike traditional virtual machines, containers usually do not run a complete guest operating system. They share the host operating system kernel while isolating processes and resources.

That generally makes them lighter and faster to start than full virtual machines.

Install Docker and Verify Your Setup

Before experimenting with containers, you need Docker installed.

On Windows or Mac:

  1. Go to docker.com
  2. Download Docker Desktop
  3. Install it following the platform instructions
  4. Start Docker Desktop

On Linux:

Installation steps vary by distribution, so follow Docker’s official instructions for your Linux distribution whenever possible.

✅ Verify that Docker is available:


docker --version


You should see the installed Docker version displayed.

🎉 If that command works, Docker is available and you are ready to continue. 

The 4 Core Docker Concepts — Without the Jargon

You mainly need four concepts to understand the basic Docker workflow:

1. Docker Image → The Blueprint for Your Application

Think of an image like a packaged template containing the filesystem and configuration required to start your application.

Examples: nginx, node:18, postgres

📦 Images are intended to be immutable building blocks. When you need a different image, you build a new version instead of editing the existing image in place.

2. Container → A Running Instance

If the image is the recipe, the container is the running result.

You start a container → the application runs.

🔄 A container can be stopped, restarted, or removed while the underlying image remains available.

3. Dockerfile → Your Build Recipe

Want to package your own application? Create a Dockerfile that describes how the image should be built.

For example:

"Start from Node.js, copy my application files, install dependencies, and define the command to run the application."

4. Docker Hub → A Registry for Container Images

Docker Hub is a container registry where you can find and publish images.

It hosts images such as redis, mongo, wordpress, and many others.

You can download an image with a Docker command.

🚦 First Steps: Run Your First Container

Let’s start an Nginx web server with two commands.

docker pull nginx
docker run -d -p 80:80 nginx

🔍 Explanation:

  • pull: downloads the nginx image from a registry
  • run: creates and starts a container from an image
  • -d: runs the container in detached mode
  • -p 80:80: maps port 80 on your machine to port 80 inside the container

👉 Open your browser: http://localhost

If you see the Nginx welcome page, the container is running successfully.

You are now serving a web page from a container. 🏆

🧠 Practical tip:

See running containers with:

docker ps

And stop one with:

docker stop <container-id>

🛠️ Build Your Own Docker Image for a Node.js Application

Want to package your own code into a container? Here is a simple example.

Create a file named Dockerfile with no extension inside your project:

FROM node:18
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["node", "index.js"]
🤔 In plain English:
  • Start from an image containing Node.js 18
  • Use /app as the working directory
  • Copy the package metadata and install dependencies
  • Copy the rest of the application
  • When the container starts, run node index.js

Then run:

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


🎯 Result: your Node.js application runs inside a container with its own isolated runtime environment. 

What Comes Next? Tools for Going Further

Once you understand images and containers, there are several important Docker concepts worth learning next.

Volumes → Persist Your Data

Container writable layers are generally disposable. If important application data only exists inside a container and that container is removed, the data may be lost.

Volumes let you store persistent data independently from the lifecycle of a particular container.

For example, a PostgreSQL container can use a volume so its database files remain available even when the container is recreated.

🔄 Docker Networks and Compose → Connect Multiple Services

Docker Compose lets you describe and run multiple services together.

For example: an API, database, front end, Redis, and other supporting services.

A simple compose.yaml might look like this:

services:
  web:
    build: .
    ports:
      - "3000:3000"
  db:
    image: postgres
    environment:
      POSTGRES_PASSWORD: example

Then start the services with:


docker compose up


✨ One configuration file can define several connected services. 

Best Practices: Build Good Docker Habits

Here are several practices worth adopting:

✅ Use appropriate, well-maintained base images

Smaller images can reduce transfer size and sometimes reduce the available attack surface, but choose an image variant that still includes everything your application requires.

✅ Tag your images deliberately

Use tags such as mon-app:v1.0 rather than relying only on latest.

✅ Prefer trusted and maintained images

Use official or otherwise trusted images from reputable publishers when possible.

Avoid random, abandoned images you cannot evaluate.

✅ Integrate container builds into CI/CD when appropriate

Tools such as GitHub Actions or GitLab CI can automate image building, testing, scanning, and deployment.

💡 Human-to-human tip:
"Start small. One container. One application. One command. Then expand from there."
Docker is not magic. It becomes easier through repeated use.

Conclusion: Docker Gives You a More Portable Development Workflow

Knowing how to use Docker can help you:

  • Reduce environment differences between machines
  • Save setup time by packaging runtime requirements more consistently
  • Become more independent when testing, shipping, and deploying applications
🚀 You do not need to be an expert.
You just need to start.

So:

  • Install Docker.
  • Run a container.
  • Create your first Dockerfile.
  • Then build something slightly more complex.

That is how you gradually become comfortable with professional development tools.

Hands-on experimentation is one of the best ways to learn Docker.

Going Further:


Share in X