Skip to content

Container

In one line

A container is a lightweight, portable package that bundles an application with everything it needs to run.

In simple words

A container is like a box that holds your application along with all its dependencies — libraries, configuration files, and system tools — so it can run the same way on any machine.

Unlike a virtual machine, a container does not include a full operating system. Instead, it shares the host OS kernel, which makes it much lighter and faster to start. A typical container starts in seconds, while a VM might take minutes.

Containers solve the "it works on my machine" problem. If your application runs in a container on your laptop, it will run identically in a container on a server, in the cloud, or on a colleague's computer — because everything inside the box is the same.

Example

bash
# Run a Node.js app in a container
docker run -p 3000:3000 my-node-app

This command starts a container from the my-node-app image and maps port 3000 from the container to the host.

How it works

  1. You write a Dockerfile that describes the application and its dependencies.
  2. You build an image from the Dockerfile.
  3. You run a container from that image.
  4. The container shares the host OS kernel but isolates its own filesystem, processes, and network.

Common confusions

  • Confused with: Virtual Machine

    The difference: A VM includes a full guest OS and is heavy; a container shares the host OS kernel and is lightweight.

Related terms

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary