What Is Docker?

Docker is a tool that packages an app and everything it needs into a container, so it runs the same way on any computer. Instead of installing the right runtime, libraries and settings on every machine, you ship one container that already has them.

01 / Compare

Containers vs virtual machines

Both run several apps, each isolated, on one computer. The difference is what each app carries with it. Switch views and change the number of apps.

Container 1

App A

Libraries

Container 2

App B

Libraries

Container 3

App C

Libraries

Docker Engine

Host operating system

Hardware

3 apps as Docker containers

Disk
450 MB
Memory
384 MB
Start time
about 1 second

Containers share the host’s kernel through Docker Engine. Each one carries only its app and libraries, so it starts like a normal program.

Typical, illustrative numbers for a small web app. Containers built from the same image also share its layers on disk.

02 / Step through

From Dockerfile to image to container

Walk a tiny Node.js web app through Docker, one line at a time. Click any line or use Next.

  1. Dockerfile · the recipe
  2. Image · the packaged app
  3. Container · the running app

Dockerfile, then terminal commands

Step 1 of 10

Start from a ready-made base image from Docker Hub: a tiny Alpine Linux userland with Node.js 22 installed. Your image is built on top of its layers.

Image layers so far: 1

  1. node:22-alpine base (Alpine Linux + Node.js)

Docker Hub and registries

A registry stores images so other machines can download them. Docker Hub is the default public registry, with official images for Node.js, Python, PostgreSQL, Nginx and thousands more. docker push uploads your image; docker pull downloads one. Teams also use private registries such as GitHub Container Registry, Amazon ECR and Google Artifact Registry.

Docker Compose for multi-container apps

Real apps often need more than one container, such as a web app plus a database. Docker Compose describes them in one compose.yaml file and starts them together with docker compose up:

services:
  web:
    build: .
    ports: ["8080:3000"]
    depends_on: [db]
  db:
    image: postgres:16
    volumes: [db-data:/var/lib/postgresql/data]
volumes:
  db-data:

Docker vs Kubernetes

They are not rivals: Docker packages and runs containers, Kubernetes manages lots of them across servers.
DockerKubernetes
What it isA tool to build images and run containersA system to run and manage containers across a cluster of machines
ScopeUsually one machineMany machines (nodes)
Main jobPackage an app and start itSchedule, scale, heal and network many containers
Typical commanddocker runkubectl apply
When you need itLocal development, CI builds, small self-hosted appsProduction apps that need high availability or autoscaling

What Docker is used for

  • Same environment for everyone

    New teammates run one command instead of following a long setup document.

  • CI/CD pipelines

    Tests and builds run in a clean container every time, and the exact image that passed is the one that ships.

  • Deploying apps

    Push an image to a registry and any server or cloud platform can pull and run it.

  • Self-hosting

    Run databases, Nextcloud, Home Assistant or a media server without installing their dependencies on your machine.

  • Trying software safely

    Start a database or tool in a container, experiment, then delete it with no leftovers.

  • Microservices

    Each service ships in its own container with its own dependencies and versions.

Docker glossary

Image
A read-only package of an app and its dependencies, built from a Dockerfile.
Container
A running, isolated instance of an image.
Dockerfile
A text file of instructions that builds an image.
Layer
One cached step of an image. Unchanged layers are reused, which makes rebuilds fast.
Registry
A server that stores images, such as Docker Hub or GitHub Container Registry.
Volume
Storage that lives outside the container so data survives when the container is removed.
Port mapping
Connects a port on your computer to a port inside the container, such as -p 8080:3000.
Docker Compose
A compose.yaml file that starts several containers together, such as an app and its database.

How to use this explainer

  1. 1. Compare the stacks

    Switch between Docker containers and virtual machines, and change the number of apps to see what repeats.

  2. 2. Check the footprint

    Read the illustrative disk, memory and start-time totals for each choice.

  3. 3. Step through the Dockerfile

    Click each line to see what it does and which image layer it adds.

  4. 4. Build and run

    Finish with docker build, docker run and docker ps to see the image become a running container.

Docker questions, answered

What is Docker in simple terms?

Docker is a tool that packages an app and everything it needs (code, runtime, libraries and settings) into a container, so it runs the same way on a laptop, a server or the cloud. It ends the “works on my machine” problem.

What is Docker used for?

Docker is used to give every developer the same environment, to run tests and builds in CI/CD pipelines, to ship apps to servers and cloud platforms, and to self-host software such as databases, dashboards and home-lab services with one command.

Is Docker a virtual machine?

No. A virtual machine runs a full guest operating system on virtual hardware. A Docker container is an isolated process that shares the host’s operating system kernel, so it is much smaller and starts in about a second. On Mac and Windows, Docker Desktop runs one small Linux VM in the background to host Linux containers.

What is the difference between a Docker image and a container?

An image is a read-only package built from a Dockerfile, like a recipe that has been cooked and frozen. A container is a running instance of that image. You can start many containers from one image, and each gets its own writable layer.

What is the difference between Docker and Kubernetes?

Docker builds images and runs containers, usually on one machine. Kubernetes orchestrates containers across many machines: it schedules them, restarts failed ones, scales them up and down and balances traffic. Many teams build with Docker and run in production on Kubernetes.

Is Docker free?

Docker Engine, the open-source core that runs containers on Linux, is free. Docker Desktop is free for personal use, education, open-source projects and small businesses; larger companies need a paid subscription under Docker’s terms. Check Docker’s current pricing page for the exact thresholds.

For commands, see the Docker Commands Cheat Sheet. For the full reference, see the official Docker overview.

Automate the container chores you repeat

Rebuilding images, running tests in containers and checking logs the same way every week? Tornic turns those steps into repeatable workflows on the AI coding CLI you already use.

Explore Tornic

Related free tools