Skip to content

Article · DevOps

What Is Docker? Containers Explained Simply

Docker packages an app with everything it needs into a container that runs the same everywhere. Learn what images and containers are and why teams use them.

Author
VoltKit
Published
Reading time
2 min read

Docker is a tool for packaging software into containers: self-contained bundles that include the application, its runtime, libraries and configuration. A container built on a developer's laptop runs identically on a colleague's machine, a test server and a cloud host, because everything it depends on travels with it.

Before containers, deploying an app meant installing the right language version, system packages and settings on every machine by hand, and something always differed. Docker replaces that with a recipe.

Images and containers

An image is the recipe's result: a read-only snapshot of a filesystem with the app inside. A container is a running instance of an image. You can start ten containers from one image, the way you can run ten copies of a program.

Images are built from a Dockerfile, a short text file of instructions:

FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
CMD ["node", "server.js"]

Each line adds a layer: start from a base image with Node.js, copy the code, install dependencies, build, and declare the command to run. Layers are cached, so rebuilding after a small change is fast.

Why teams use Docker

  • Consistency. The same image runs in development, testing and production.
  • Isolation. Two apps needing different Python versions run side by side without conflict.
  • Speed. Containers start in milliseconds and share the host's operating system kernel, unlike virtual machines.
  • Portability. Every major cloud can run containers directly, and orchestrators such as Kubernetes schedule thousands of them.
  • Reproducible onboarding. A new developer runs one command instead of following a ten-page setup document.

Basic commands

docker build -t myapp .          # build an image from the Dockerfile in this folder
docker run -p 3000:3000 myapp    # start a container, mapping port 3000
docker ps                        # list running containers
docker logs <container>          # read a container's output
docker compose up -d             # start a multi-container stack in the background

Compose files are written in YAML. If you have configuration in JSON, the JSON to YAML converter produces correctly quoted YAML for them.

  • Registries such as Docker Hub and GitHub Container Registry store and share images, like package registries for containers.
  • Kubernetes runs containers across many machines, handling scaling, restarts and networking.
  • Volumes persist data outside a container so it survives restarts; containers themselves are meant to be disposable.
  • Environment variables configure containers at start time (-e DATABASE_URL=...), keeping secrets out of images.

Frequently asked questions

Is Docker a virtual machine?

No. A virtual machine emulates a whole computer with its own operating system. A container shares the host's kernel and isolates only the processes, files and network, so it starts in milliseconds and uses far less memory.

Do I need Docker to run software?

No, but it removes the 'works on my machine' problem. If a project ships a Docker image, you can run it without installing its language, libraries or dependencies yourself.

What is Docker Compose?

A tool that starts several containers together from one YAML file, for example a web app, its database and a cache. `docker compose up` brings the whole stack up.

Is Docker free?

The Docker engine and command-line tools are open source and free. Docker Desktop, the graphical app for Mac and Windows, is free for individuals and small companies and paid for larger businesses.

← Back to Learn

You might also like

Something useful from another corner of VoltKit.