Dashboard

What Is Docker? A Guide for AI App Builders

Docker gets recommended constantly to people whose AI-built app is running fine without it. Here is what it actually does, where the complexity is worth paying, and the three situations where you will know you need it.

Carlo Zuercher
Carlo Zuercher
Staff Engineer, Platform
22 October 20261 min read

Docker packages an application together with everything it needs to run, so it behaves the same on your laptop, on a colleague's machine, and on a server. Docker's own documentation calls it "an open platform for developing, shipping, and running applications," whose purpose is to separate applications from the infrastructure they run on.

Whether you need it is a separate question from what it is, and for a lot of AI-built apps the honest answer is not yet. This post covers both, because the second question is the one people are usually asking.

The shipping container metaphor, and where it breaks

The name is the explanation. A shipping container standardises the outside so a crane, a lorry, and a ship can all handle it without caring what is inside. Docker standardises the outside of your application so any machine running Docker can run it without caring whether it is Python, Node, or Go.

Where the metaphor misleads: a shipping container is sealed and heavy, and a Docker container is neither. Docker's documentation describes a container as a "loosely isolated environment" and, more usefully, as "a runnable instance of an image." It is a running process on your machine, sharing the host's kernel, started and stopped in under a second.

Image, container, Dockerfile

Three words that get used interchangeably and should not be.

  • An image is, in the documentation's words, "a read-only template with instructions for creating a Docker container." It is the build output. Think of it as the installer.

  • A container is a running instance of that image. One image, many containers, each disposable.

  • A Dockerfile is the recipe the image is built from. Each instruction adds a layer, which is why reordering the lines changes how fast rebuilds go.

There are also two pieces of Docker itself worth knowing by name, because error messages mention them. The daemon, dockerd, "listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes." The client, docker, is what you type; it sends your command to the daemon over a REST API. "Cannot connect to the Docker daemon" means the engine is not running, not that your app is broken.

When an agent writes a Dockerfile for you, the layer ordering is the thing to check first. Our guide on prompting AI to write a Dockerfile that builds fast covers what good looks like.

Container or virtual machine?

A virtual machine emulates a whole computer, with its own operating system kernel, booted by a hypervisor. A container shares the host's kernel and isolates the process above it. The practical consequences:

Container

Virtual machine

Startup

Under a second

Tens of seconds

Size

Tens to hundreds of megabytes

Gigabytes

Isolation

Process level, shared kernel

Full, own kernel

Run a different OS kernel

No

Yes

Docker's documentation puts it as being "a viable, cost-effective alternative to hypervisor-based virtual machines," with images that are lightweight and fast compared with other virtualization technologies. The tradeoff is the isolation column: for most application work the shared kernel is fine, and it is why the startup and size numbers are what they are.

The three cases where you need it

If your app runs on a managed platform that builds from your repository, you may never touch Docker, and that is a legitimate end state rather than a gap in your education. Here is when it stops being optional.

  1. You need a service your host does not provide. A specific Postgres version, Redis, a vector database, a headless browser. Running them as containers locally is far less painful than installing each one on your machine, and the docker compose file becomes the documented list of what your app depends on.

  2. It works on your machine and not on the server. This is the problem Docker was built for. If you have lost a day to a version difference between local and production, the image is the fix, because you ship the environment rather than hoping two of them match.

  3. You are giving an AI coding agent a place to run commands. A container is a cheap blast radius. The agent installs, breaks, and reinstalls inside it, and your actual machine is untouched.

That third one has become the most common first reason to learn Docker, and we wrote it up separately in a dev container for your AI coding agent.

When to skip it

A single web app with a managed database, deployed by a platform that handles the build: adding Docker here buys you portability you are not using and costs you a build step to maintain. A static site: no. A set of scripts you run on your own laptop: no.

Containers are also not a deployment platform on their own. Something still has to run them, restart them when they die, and route traffic to them. If that something is currently your hosting provider's build pipeline, introducing Docker means taking on work the provider was doing. Worth it for case two above, not worth it for tidiness.

The vocabulary around it

Docker sits in the middle of a cluster of terms you will meet at the same time. A docker-compose.yml file is YAML, so what a YAML file is is worth five minutes first. Containers listen on ports, which is where localhost comes in, and the reason a container running on port 3000 is not reachable until you map it. And the main architectural alternative is serverless, where you do not manage a running process at all.

For the broader picture of which of these tools matter when an agent is doing the typing, see our guide to AI coding tools.

Questions people ask

Do I need Docker if my app already deploys fine?

No. Add it when you hit one of the three cases above: a dependency your host will not run, an environment mismatch you cannot explain, or an agent you want to sandbox. Adding it before then is maintenance work with no return.

Is Docker the same as Kubernetes?

No. Docker builds and runs containers. Kubernetes orchestrates many containers across many machines, deciding what runs where and restarting what fails. You can use Docker for years without needing Kubernetes, and almost every small app should.

Will a container make my app faster?

Not meaningfully. Containers share the host kernel so the overhead is small, but there is no speed gain either. What they give you is consistency between environments, not performance.

What happens to my data when a container stops?

Anything written inside the container is gone, which is the point of a disposable instance and the most common beginner surprise. Data that must survive goes in a volume, which lives on the host and is mounted into the container.

How did this land?

About the author

Carlo Zuercher
Carlo Zuercher

Staff Engineer, Platform

Carlo works on the platform that turns prompts into running apps. He writes the engineering deep dives and the changelog notes worth reading.

Share

Get the next post in your inbox

One email a month. Product updates, engineering posts, and the best of Built with Swarmz.

I agree to receive emails about AI building tips and Swarmz product news. Unsubscribe any time.