What Is Docker? A Beginner's Guide to Containers
What Docker actually is, how containers differ from VMs, what Desktop, Engine, Compose, and Hub each do, and how to run your first container.

Docker is a platform for packaging an application and everything it needs — code, runtime, system tools, libraries — into a single lightweight unit called a container, so it runs the same way on a laptop, a test server, or in the cloud. Unlike a virtual machine, a container doesn't carry its own operating system; it shares the host machine's kernel, which is why containers start in a fraction of a second and measure in megabytes rather than gigabytes. The word "Docker" covers a whole toolset, not one program: Docker Engine runs containers, Docker Desktop is the point-and-click app most people install, Docker Compose coordinates multi-container apps, Docker Hub stores and distributes images, and Docker Swarm is the built-in option for running containers across a cluster.
- What it is: an open platform for building, shipping, and running applications in containers.
- Container vs. image: an image is the packaged, ready-to-run app; a container is a running instance of that image.
- Docker Desktop: the GUI app for Mac, Windows, and Linux that bundles the Docker Engine, CLI, Compose, and Kubernetes.
- Docker Engine: the underlying open-source client-server technology (the
dockerddaemon plus thedockerCLI) that actually builds and runs containers. - Docker Compose: a tool that defines multi-container apps in one
compose.yamlfile and starts them with one command. - Docker Hub: Docker's own public registry for storing and pulling container images.
- Docker Swarm: Docker Engine's built-in clustering mode for running containers across multiple machines.
- Cost: Docker Desktop is free for personal use, education, and small businesses; companies with 250+ employees or $10M+ in annual revenue need a paid Pro, Team, or Business subscription.
What is Docker used for?
Docker's own documentation describes it as "an open platform for developing, shipping, and running applications," built specifically so teams can "separate your applications from your infrastructure" and ship software faster. In practice, that plays out in a handful of very common jobs:
- Consistent environments. A container packages an app with its exact dependencies, so "it works on my machine" stops being a problem — the same image runs identically in development, staging, and production.
- Microservices and APIs. Each service (a database, a web server, a background worker) runs in its own container, isolated from the others but able to talk over a shared network.
- CI/CD pipelines. Build agents spin up a clean container for every run, install exactly what's declared in a Dockerfile, run the tests, and throw the container away — no leftover state from the previous build.
- Local development. Instead of installing Postgres, Redis, and three other services directly on your laptop, you run them as disposable containers and delete them when you're done.
- Packaging legacy or multi-language stacks. Docker doesn't care what's inside the container, so a Python script, a Node app, and a Java service can all be built, versioned, and deployed the same way.
If you're also exploring newer AI-assisted developer tooling, it's worth noting Docker containers underpin a lot of it — the Model Context Protocol explainer we published covers one example of a protocol whose reference servers are commonly distributed as containers.
What is a Docker container?
Per Docker's own "get-started" documentation, a container is "simply an isolated process with all of the files it needs to run" — nothing more exotic than that. It is not a tiny virtual machine. A container:
- Has "everything it needs to function with no reliance on any pre-installed dependencies" on the host.
- Runs in isolation, with "minimal influence on the host and other containers."
- Is independently managed — stopping or deleting one container doesn't touch any other.
- Is portable: the same container "that runs on your development machine will work the same way in a data center or anywhere in the cloud."
The confusing part for newcomers is the difference between an image and a container. Docker's own docs put it simply: "An image is a ready-to-run package that contains an application and everything it needs. A container is a running instance of an image." You build or pull an image once; you can then start, stop, and throw away as many containers from that image as you like, and each one starts fresh.
Container vs. virtual machine: what's the real difference?
Containers and virtual machines solve a similar problem — isolating one workload from another on shared hardware — but they do it at a different layer. A VM virtualizes an entire computer, including its own kernel, drivers, and OS install. A container virtualizes only the operating system's user space, and every container on a host shares that host's kernel.
| Container | Virtual machine | |
|---|---|---|
| What it virtualizes | The operating system (user space) | The physical hardware |
| Includes its own kernel? | No — shares the host kernel | Yes — full guest OS and kernel |
| Typical size | Tens of megabytes | Tens of gigabytes |
| Startup time | Near-instant | Can be slow to boot |
| Isolation boundary | Isolated process in user space | Full hardware-level isolation via a hypervisor |
| Managed by | A container runtime (e.g., Docker Engine) | A hypervisor |
Docker's own explainer on this sums it up directly: "Containers are more portable and efficient" than VMs precisely because they don't need to boot or carry a complete operating system per workload. VMs remain useful when you need strict hardware-level isolation or need to run a different kernel entirely (say, Windows workloads on a Linux host); containers win when you want many lightweight, fast-starting, consistently-reproducible app environments on the same machine.
What is Docker Desktop?
Docker Desktop is, in Docker's own words, "a one-click-install application for your Mac, Linux, or Windows environment that lets you build, share, and run containerized applications and microservices." It's the easiest on-ramp for most developers because it bundles several separate pieces into one installer:
- The Docker Engine (daemon + CLI)
- Docker Compose
- Docker Build and Docker Scout
- A current version of Kubernetes you can enable with a toggle
- A graphical interface for managing containers, images, and volumes without touching the command line
It also quietly handles the plumbing that's easy to get wrong by hand — port mappings, file-system/volume mounting with live change notifications, and (on Windows) switching between Linux and Windows containers via Hyper-V virtualization. Docker Desktop is free for personal use, education, and small businesses, but — per Docker's published subscription terms — a commercial organization with 250 or more employees or $10 million or more in annual revenue needs a paid Pro, Team, or Business subscription to use it; government entities need a subscription regardless of size. None of that licensing affects Docker Engine itself when you run it directly on Linux without Docker Desktop, which stays open source under the Apache License 2.0.
What is Docker Compose?
Most real applications aren't one container — they're a web app, a database, a cache, maybe a background worker, all talking to each other. Docker Compose is, per Docker's documentation, "a tool for defining and running multi-container applications." You describe every service, its image, its environment variables, its ports, and its networks in a single compose.yaml file, then run one command to create and start the whole stack together.
A minimal example might look like this:
services:
web:
build: .
ports:
- "8000:8000"
redis:
image: "redis:alpine"
Compose works the same way across "production, staging, development, testing, as well as CI workflows," and gives you simple lifecycle commands to start, stop, rebuild, and tail logs for every service at once instead of juggling several separate docker run commands by hand.
What is Docker Hub?
Once you've built an image, you need somewhere to store and share it — that's a registry. Docker Hub is Docker's own registry, described in its docs as "the world's largest container registry for storing, managing, and sharing Docker images." It offers unlimited public repositories, a limited number of free private repositories, automated build hooks tied to GitHub or Bitbucket, and a library of "Docker Official Images" — vetted, regularly updated base images for things like Postgres, Nginx, and Python — that most Dockerfiles in the wild start from. You can also run your own private registry instead of (or alongside) Docker Hub, which many companies do for proprietary images.
What is Docker Swarm?
Once containers move into production, a single host often isn't enough — you want them spread across several machines, with automatic scheduling, scaling, and failover. That's where orchestration comes in, and Docker Swarm is Docker Engine's own built-in answer: an "advanced feature for managing a cluster of Docker daemons," usable directly through the regular docker CLI, with no extra software to install. Docker's documentation recommends using Swarm mode specifically "if you intend to use Swarm as a production runtime environment," and separately notes that Docker Desktop also ships an integrated Kubernetes option for teams who want that ecosystem instead. Swarm handles cluster scheduling and load balancing, embedded DNS-based service discovery, TLS-secured node-to-node communication, and rolling service updates with rollback — useful if you want orchestration without adopting a heavier system. (Kubernetes itself is a much bigger topic with its own learning curve — worth its own guide rather than a detour here.)
Docker Desktop vs. Docker Engine vs. alternatives
It helps to separate "Docker the company's products" from "the open container tooling ecosystem" more broadly:
| Tool | What it is | Typical use |
|---|---|---|
| Docker Engine | Open-source daemon + CLI that builds and runs containers | Linux servers, CI runners, anywhere you don't need a GUI |
| Docker Desktop | GUI app bundling Engine, Compose, Build, Scout, Kubernetes | Local development on Mac, Windows, or Linux |
| Docker Compose | Multi-container app definition and orchestration on one host | Local stacks, small deployments, CI test environments |
| Docker Swarm | Built-in multi-host clustering inside Docker Engine | Simple production orchestration without extra tooling |
You'll also hear about alternative container runtimes and desktop tools (Podman, containerd directly, Rancher Desktop, and others) that implement the same open container image format — images built for Docker will generally run on them too, since the industry standardized around the OCI (Open Container Initiative) image spec that Docker itself helped create.
What is a Docker image, and how do I build one?
An image is the blueprint: an immutable, layered file system snapshot containing your app and its dependencies. You build one with a Dockerfile — described in Docker's reference docs as "a text document that contains all the commands a user could call on the command line to assemble an image." Docker reads it top to bottom and executes each instruction as a new layer. The handful of instructions you'll use in almost every Dockerfile are:
FROM— sets the base image everything else builds on (must be the first real instruction)WORKDIR— sets the working directory inside the image for the instructions that followCOPY— copies files from your project into the imageRUN— executes a command at build time (e.g., installing dependencies), creating a new layerENV— sets environment variables available at build time and at runtimeEXPOSE— documents which port the container listens on (informational only — it doesn't publish the port by itself)CMD— the default command that runs when a container starts from the image
A bare-bones Dockerfile for a small Python app looks roughly like this:
FROM python:3.12-slim
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
EXPOSE 8000
CMD ["python", "app.py"]
Running docker build -t my-app . turns that Dockerfile into an image; running docker run my-app starts a container from it.
How to get started with Docker
Docker's own "Get Started" guide walks through this exact sequence, and it holds up as the fastest path from zero to a running container:
- Install Docker Desktop. Download it for Mac, Windows, or Linux from Docker's site and run the installer — no separate Docker Engine install is needed, since Desktop bundles it.
- Create a free Docker account (needed later if you want to push images to Docker Hub).
- Run your first container. Open a terminal and run:
Docker pulls the smalldocker run hello-worldhello-worldimage from Docker Hub if you don't already have it locally, then runs it as a container, which prints a confirmation message and exits. It's the container-world equivalent of "Hello, World." - Run something more realistic. Try an actual web server, mapping a host port to the container's port:
Then opendocker run -d -p 8080:80 nginxhttp://localhost:8080in a browser to see it respond. - Write a Dockerfile for your own app (see the example above), then build and run it with
docker buildanddocker run. - Move to Compose once you have more than one container — a database alongside your app, for instance — by describing both services in a
compose.yamlfile and starting them withdocker compose up. - Push your image to Docker Hub to share it, tagging it with your Docker Hub username first (e.g.,
docker tag my-app yourusername/my-app, thendocker push yourusername/my-app).
If you're setting this up inside Windows Subsystem for Linux rather than installing Docker Desktop's own Windows build, our WSL2 explainer covers how that environment works and how to enable it, since Docker Desktop on Windows uses the WSL2 backend by default. And if you're setting up a fresh dev machine generally, it's worth pairing a current Git install — see our Git 2.56 update guide — alongside Docker from day one, since most Dockerfiles live in a Git repo.
Do I need Docker Desktop on Linux?
Not necessarily. On Linux, you can install Docker Engine directly — the daemon and CLI, without the GUI — and it runs natively without the extra virtualization layer that Mac and Windows need, since Linux already has the kernel features containers rely on. Docker Desktop for Linux exists too, mainly for developers who want the same GUI experience across all three platforms. If you're choosing a Linux distribution for a new dev box in the first place, our comparison of Ubuntu, Linux Mint, and Zorin OS is a reasonable starting point — all three support Docker Engine through their standard package repositories or Docker's official install scripts.
Common beginner mistakes
- Confusing images and containers. Remember: image = the packaged blueprint, container = a running instance of it. You can run many containers from one image.
- Forgetting that container file changes don't persist by default. Stop and remove a container and, unless you used a volume or bind mount, anything written inside it is gone. Persistent data belongs in a Docker volume.
- Building huge images. Starting from a full OS base image and installing everything on top produces slow, bloated images. Slimmer base images (like
-slimor-alpinevariants) and multi-stage builds keep images small. - Not pinning image versions. Using a base image's
latesttag means your build can change underneath you without warning; pinning a specific version tag keeps builds reproducible. - Assuming EXPOSE publishes a port. It only documents intent — you still need
-pondocker run(or aports:entry in Compose) to actually map the port to the host.
What's next, and the bottom line
Docker's core ideas — package once, run anywhere, isolate with the host kernel instead of a full guest OS — haven't really changed since the project's early releases, which is exactly why it's still the default starting point for learning containers. Where the ecosystem keeps moving is around it: Docker's own subscription terms and bundled tooling (Scout for image vulnerability scanning, Build Cloud for faster builds) continue to evolve, and once an app outgrows a single host or a Swarm cluster, most teams eventually look at Kubernetes for larger-scale orchestration — a big enough topic on its own to deserve separate coverage rather than a rushed summary here.
For a single developer or a small team, though, the practical bottom line hasn't changed: install Docker Desktop, run docker run hello-world to confirm it works, write a short Dockerfile for your app, and reach for Compose the moment you need more than one container talking to each other. Everything else in the Docker ecosystem — Hub, Swarm, Scout, Build Cloud — is there for when you need it, not before.
Frequently asked questions
What is Docker used for?
Docker is used to package an application and its dependencies into a portable container so it runs consistently across development, testing, and production. Common uses include microservices, CI/CD pipelines, local development environments, and packaging apps written in different languages the same way.
What is the difference between a Docker image and a Docker container?
An image is a ready-to-run, packaged version of an application and everything it needs. A container is a running instance of that image. You can start many separate containers from the same image.
Is Docker Desktop free?
Docker Desktop is free for personal use, education, and small businesses. Commercial organizations with 250 or more employees or $10 million or more in annual revenue need a paid Docker Pro, Team, or Business subscription, per Docker's published subscription terms.
What is Docker Compose used for?
Docker Compose defines a multi-container application in a single compose.yaml file, describing each service, its image, ports, and networking, so the whole stack can be started or stopped together with one command.
What is Docker Swarm?
Docker Swarm is Docker Engine's built-in clustering and orchestration feature for running containers across multiple machines, with automatic scheduling, service discovery, and rolling updates, usable directly from the standard Docker CLI.
Do I need a virtual machine to run Docker containers?
No. Containers share the host machine's kernel instead of running their own full operating system, which is why they are much lighter and faster to start than virtual machines. On Mac and Windows, Docker Desktop still uses a lightweight virtualization layer behind the scenes to provide a Linux kernel for containers.
Sources
- Docker Docs — What is Docker?docs.docker.com
- Docker — What is a Container?docker.com
- Docker Docs — Docker Desktop overviewdocs.docker.com
- Docker Docs — Docker Compose overviewdocs.docker.com
- Docker Docs — Docker Hub overviewdocs.docker.com
- Docker Docs — Swarm mode overviewdocs.docker.com
Felix Moreau writes Pandromeda's software coverage and how-to guides. He covers Windows, macOS and Linux updates, the apps people rely on, emulators and developer tools, and turns official documentation into clear, numbered steps that work on the current version.

