tezvyn:

Docker Engine: Shipping Your Code in a Standard Box

AI-drafted, machine-checkedSource: Wikipedia: Docker Enginebeginner
Docker Engine: Shipping Your Code in a Standard Box

Think of Docker as a standard shipping container for your code. It packages an app and all its dependencies into one unit that runs anywhere, solving the classic "it works on my machine" problem. The footgun is confusing it with a full VM; it's lighter.

WHY IT EXISTS The core problem Docker solves is environment inconsistency. An application might work on a developer's laptop but fail on a production server due to differences in operating systems, library versions, or configurations. Docker was created to package an application and its environment together, ensuring it runs the same everywhere.

THE MENTAL MODEL Imagine a standard shipping container. Before them, loading a ship was a custom job for every type of cargo. Shipping containers standardized the process: anything can go in the same box, and any ship, train, or truck can handle it. Docker does this for software. Your app and its dependencies go into a "container," and any machine running Docker can run it without custom setup.

HOW IT WORKS Docker uses a technique called operating system-level virtualization. Unlike a Virtual Machine (VM) that emulates an entire hardware stack and runs a full guest OS, a Docker container shares the host machine's OS kernel. It isolates the application's process, filesystem, and network, making it feel like its own lightweight machine but with much less overhead. An application is packaged into an "image," a read-only template. When you run an image, it creates a runnable instance called a "container."

WHEN TO USE IT Use Docker to ensure application portability and consistency across different environments, from development to production. It is ideal for microservices architectures, where each service can be packaged and deployed independently. It also dramatically simplifies setting up complex local development environments for new team members.

WHEN NOT TO USE IT Avoid Docker if you require the strong security isolation of a full virtual machine, such as when running untrusted code from multiple tenants on the same host. For very simple applications with no external dependencies that will only ever run on one machine, Docker might be unnecessary overhead.

ONE CANONICAL EXAMPLE A developer builds a Python web app on their laptop. It depends on a specific Python version and several libraries. Instead of manually installing these on a production Linux server and risking version conflicts, they write a Dockerfile. This file instructs Docker to start from a base Python image, copy the app code, and install the required libraries. The resulting Docker image is pushed to a registry. The production server simply pulls this image and runs it as a container, guaranteeing an identical environment.

Read the original → en.wikipedia.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.