Home Projects Services Blog Contact
Back to Blog

Article

Subtitle

TL;DR

Summary

The Problem Docker Solves

You build an app on your laptop. It works perfectly. You send it to your colleague — it crashes.

The reason: Python version mismatches, library version differences. Docker eliminates this entirely.

Think of shipping containers on a cargo ship — each isolated, each identical.

Image vs Container

An image is the recipe. A container is the dish. You can create 10 containers from the same image.

A container is a lightweight, isolated process. Its own filesystem, its own network.

Your First Docker Commands

Terminal
# Pull and run an official image
docker pull nginx
docker run -p 8080:80 nginx

# List running containers
docker ps

# Stop a container
docker stop 

# Run interactively
docker run -it ubuntu bash

Your First Dockerfile

A Dockerfile is the recipe for your image:

Dockerfile — Django App
FROM python:3.11-slim

WORKDIR /app

# Install dependencies first (caching)
COPY requirements.txt .
RUN pip install -r requirements.txt

# Copy your code
COPY . .

EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]

In Tunisia, OVH, Contabo, and Hetzner VPS all support Docker. This is the standard deployment method today.

Docker Compose — Multiple Services

Your app often needs a database. Compose lets you define everything in one file:

docker-compose.yml
version: "3.9"
services:
  web:
    build: .
    ports:
      - "8000:8000"
    environment:
      - DATABASE_URL=postgresql://user:pass@db:5432/mydb
    depends_on:
      - db

  db:
    image: postgres:16-alpine
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: pass
      POSTGRES_DB: mydb
    volumes:
      - pgdata:/var/lib/postgresql/data

volumes:
  pgdata:

Key Takeaways

Docker is not optional anymore — it's a professional standard. Once you learn it, you'll never deploy without it.

Tous les articles Article suivant