Cloud Infrastructure

Containers Explained for Non-Programmers

Software containers package an application with everything it needs so it runs the same on a laptop, a server or the cloud. Here is how, without jargon.

On this page
  1. The problem containers solve
  2. The shipping container comparison
  3. What is inside a container
  4. Images and containers
  5. How containers differ from virtual machines
  6. Why people use them
  7. Running many containers: orchestration
  8. Limits and cautions
  9. A quick example

The problem containers solve

Software rarely runs alone. A typical application needs a particular version of a programming language, several supporting libraries, specific settings, and sometimes a particular version of the operating system. If any piece differs, the program may behave differently or fail.

Developers have long dealt with the phrase “it works on my machine.” The application ran fine on the programmer’s laptop, but on a test server or a customer’s computer something was slightly different, and it broke.

Software containers address this by bundling the application together with the pieces it depends on, so that it starts from the same known state wherever it is run.

The shipping container comparison

The name comes from physical shipping containers. Before standard steel boxes, cargo was loaded in many shapes and handled differently at each port. Once containers had standard sizes, the same box could move between ship, train and truck without anyone unpacking it. The contents did not matter to the crane.

A software container works in a similar spirit. The package has a standard format. Whoever runs it, whether a developer’s laptop, a company server or a cloud provider, uses the same tooling to start it. What is inside is the application’s business.

The analogy has limits. Software containers are not physically separate boxes, and they still depend on the computer underneath them.

What is inside a container

A container typically holds:

  • the application’s own code
  • the libraries and tools it needs
  • configuration defaults
  • a minimal set of operating system files

It does not usually include a full operating system kernel, the core part that talks to hardware. Instead, containers on the same machine share the host’s kernel, while the operating system uses built-in isolation features to give each container its own view of files, processes and network settings. As a result, a container can see its own files and processes but not those of its neighbors.

Images and containers

Two terms are worth separating.

An image is the packaged, read-only blueprint, like a recipe or a template. It is built once, following a written list of steps, and can be stored and shared.

A container is a running instance of that image, like a dish made from the recipe. You can start many containers from one image, and each runs independently. When a container is stopped and removed, any changes made inside it are normally lost unless data was deliberately saved somewhere outside.

That last point matters: containers are usually treated as disposable. If one misbehaves, the usual response is to stop it and start a fresh copy from the image.

How containers differ from virtual machines

Both containers and virtual machines isolate applications, but they do it at different levels. A virtual machine includes a complete guest operating system running on virtualized hardware. A container shares the host’s kernel and carries only what sits above it.

For that reason, containers are usually smaller and start much faster, often in seconds or less, and a single machine can typically run more of them. The trade-off is that isolation is generally considered less strict, since containers share a kernel. For sensitive workloads, organizations may run containers inside virtual machines to combine both approaches.

Why people use them

  • Consistency. The same image runs in development, testing and production, which reduces surprises.
  • Efficiency. Because they are lightweight, more applications can share the same hardware.
  • Speed. New copies start quickly, which helps when demand spikes.
  • Portability. Moving from one environment to another is often simpler, though not always effortless.
  • Modular design. Many teams split an application into small services, each in its own container, so they can be updated separately.

Running many containers: orchestration

Running one container is simple. Running hundreds across many machines is not. Something has to decide which machine runs each container, restart any that crash, add copies when traffic grows and route requests between them. Software called an orchestrator does this. The best known open-source example is Kubernetes. Orchestration is part of the machinery behind modern cloud infrastructure, though it adds a learning curve that small projects may not need.

Containers also underlie some serverless computing platforms, where the provider quietly starts a container to run your code when needed.

Limits and cautions

Containers are not a cure-all.

  • Security depends on what you put in. An image built on outdated components carries their known flaws. Teams scan images and apply software updates by rebuilding them.
  • Shared kernel risk. A serious flaw in the host kernel can affect every container on it.
  • Data needs a plan. Because containers are disposable, important data such as a database should be stored on separate, durable storage and protected with data backups.
  • Complexity. Orchestration, networking between containers, and monitoring can be demanding for small teams.
  • Not every program fits. Some older or specialized software is hard to containerize.

A quick example

Imagine a small web application that needs a specific version of a language runtime and three libraries. A developer writes a short recipe file listing the base files, the libraries and the command to start the app. The tooling builds this into an image. A teammate on a different computer, or a cloud service, pulls the image and runs it, getting the same behavior without installing the language or libraries by hand.

For non-programmers, the takeaway is simple: a container is a standardized package that lets software travel between computers without falling apart on arrival.

The complete guide to cloud infrastructure

How Cloud Infrastructure Works Behind the Scenes
Read the guide

Keep exploring

Guides from other topics

All topics →