{"canonical_url":"https://engineer.company/glossary/docker/","content_markdown":"# Docker\n\n## What it is\n\nDocker is a toolset for packing a program, its libraries, its language runtime and its files into\none artefact called an image, and then running that image as an isolated process called a container.\nThe image is built once from a recipe, the Dockerfile, and the same image then starts on a laptop,\non a build server and in production. That is the whole promise in one sentence: the thing that was\ntested is, byte for byte, the thing that runs.\n\nFour nouns carry most of the vocabulary. A Dockerfile is a text file of instructions such as `FROM`,\n`COPY` and `RUN`. An image is a read-only template built from those instructions, stored as a stack\nof layers, one per instruction, so that a rebuild after a small change only redoes the layers that\nchanged. A container is a running instance of an image with a thin writable layer on top. A\nregistry, such as Docker Hub or a cloud provider's own, is where images are pushed and pulled.\n\nUnder the command line sits a client and a server. The `docker` command is a client; it sends\nrequests over a REST API, usually through a Unix socket, to a long-running daemon called `dockerd`.\nThe daemon owns images, containers, networks and volumes. For the container lifecycle itself it\nhands work down to containerd, and containerd by default uses runc, the small program that asks the\nLinux kernel for namespaces and control groups and starts the process inside them. A container is\ntherefore an ordinary process on the host kernel with a restricted view of the system. It is not a\nvirtual machine, and on macOS or Windows Docker Desktop runs a small Linux virtual machine to have a\nLinux kernel to share.\n\nThe image format outgrew the company that made it. In June 2015 Docker, CoreOS and others launched\nthe Open Container Initiative, Docker donated its image format and runc to it, and the resulting\nspecifications are why an image built with Docker runs unchanged under Podman, containerd or a\nmanaged cloud service.\n\n## Why it matters\n\nThe useful question is never \"Docker or not\" in the abstract. It is whether a given workload earns\nan image, or whether a plain service on the host would do the same job with fewer moving parts.\n\nAn image earns its place when the program drags an environment behind it. A Python or R application\nthat needs one exact set of packages, a legacy service pinned to an old runtime, two programs that\nwant conflicting versions of the same library: each of these is painful to reproduce by hand and\ntrivial to reproduce from an image. Rolling back means starting the previous image. A new developer\nruns one command instead of following a page of setup notes. Docker vs a virtual machine comes down\nto the same trade from the other side: containers start in moments and share one kernel, so dozens\nfit on a host that would hold a handful of virtual machines, at the price of weaker isolation.\n\nThe cost is real infrastructure. By default the daemon runs as root and manages networking; Docker also supports rootless mode.\nThere is a registry to run or pay for, base images that collect security fixes and need rebuilding\nto receive them, and a storage layer whose rules differ from the host's. A single static binary with no\ndependencies gains very little from all that, and a sandboxed systemd unit runs it just as well.\n\nThe difference between Docker and Podman matters here too. Both run the same images and accept most\nof the same commands. Docker uses a daemon, privileged by default; Podman starts\ncontainers directly as children of the command or of systemd. For a laptop the difference is small.\nFor a server whose firewall and process supervision someone has already designed, it can decide the\nquestion.\n\n## What it looks like in practice\n\nDocker appears across this site's work, and one of the projects is a deliberate decision to leave it\nout.\n\nBetween 2022 and 2024, twenty containerised applications ran across Google Cloud and AWS, among them\nanalytics applications written in R, where reproducing the exact package set is the hard part.\n[The twenty were deployed and maintained with consistent configuration and monitoring](/portfolio/ran-20-docker-apps-on-google-cloud-and-aws/),\nwhich kept them stable and reproducible and made problems faster to diagnose across the clouds.\n\nAt larger scale, a fleet of a hundred Docker applications sat on Ubuntu hosts behind a mix of Apache\nand Nginx, and each needed a valid TLS certificate.\n[An ACME-based workflow issued, renewed and deployed those certificates automatically](/portfolio/automated-ssl-tls-certs-for-100-docker-apps/),\nso all hundred kept valid certificates and the manual certificate work disappeared.\n\nThe third case points the other way. On a host whose firewall rules come from a hardening role,\n[the container plane went onto Podman and Quadlet instead of Docker](/portfolio/ran-containers-on-podman-and-quadlet/),\nbecause Docker's default networking rewrites the kernel's packet-filter rules and publishes\ncontainer ports above the firewall's own. The reason is written down with the choice, so the next\nperson to touch the host knows the default was weighed rather than forgotten.\n\n## Where it goes wrong\n\nDocker makes the first container easy. The trouble arrives later, usually in one of these four\nforms.\n\n**A port the firewall blocks answers from the internet.** By default a published port binds to every\naddress on the host, and the packet-filter rules Docker writes send that traffic to the container\nbefore a tool such as ufw ever sees it. The firewall reports the port as closed while it is open.\nWhen only a local reverse proxy needs the container, publish to the loopback address:\n\n```sh\n# reachable from anywhere, whatever ufw reports\ndocker run -d -p 8080:80 nginx:1.27\n\n# reachable only from the host itself\ndocker run -d -p 127.0.0.1:8080:80 nginx:1.27\n```\n\n**Data vanishes with the container.** Anything written to the container's own writable layer is\ndeleted when the container is removed, which is exactly what an upgrade does. Databases, uploads and\nanything else that must survive go on a named volume or a bind mount, and that volume then needs a\nbackup of its own.\n\n**A rebuild produces something different from last week.** A tag such as `python:3` or `latest` is a\nmoving pointer, so the same Dockerfile can build a different image on a different day. Pin base\nimages to a specific version, or to a digest when the build must be exactly repeatable, and rebuild\non purpose when the base image publishes security fixes.\n\n**A credential ships inside the image.** Build arguments and environment variables persist in the\nfinal image, and a file copied in one layer stays in that layer even if a later instruction deletes\nit. Anyone who can pull the image can read it. Pass secrets to the build through a secret mount,\nwhich exposes them to a single `RUN` step without writing them into any layer.\n\n## Further reading\n\n- [Docker Docs](https://docs.docker.com/) — the official manuals, guides and reference for the\n  engine, the command line and Compose.\n- [Docker overview](https://docs.docker.com/get-started/docker-overview/) — the client, the daemon,\n  images and containers explained by the project itself.\n- [Port publishing and mapping](https://docs.docker.com/engine/network/port-publishing/) — why\n  published ports are open to the outside by default, and how to bind them to localhost.\n- [Packet filtering and firewalls](https://docs.docker.com/engine/network/packet-filtering-firewalls/)\n  — how Docker writes iptables or nftables rules and where ufw stops seeing the traffic.\n- [Build secrets](https://docs.docker.com/build/building/secrets/) — passing credentials to a build\n  without leaving them in the image.\n- [OCI Image Format Specification](https://github.com/opencontainers/image-spec) — the open standard\n  that lets one image run under Docker, Podman and containerd alike.\n\n\u003chttps://engineer.company/glossary/docker/\u003e\n","date_modified":"2026-11-12T05:34:23Z","description":"What Docker is, how an image becomes a container, when a workload earns one, and four mistakes that surface only after the first deploy.","formats":{"gemtext":"https://engineer.company/glossary/docker/index.gmi","gopher":"https://engineer.company/glossary/docker/gophermap","html":"https://engineer.company/glossary/docker/","json":"https://engineer.company/glossary/docker/index.json","markdown":"https://engineer.company/glossary/docker/index.md","pdf":"https://engineer.company/glossary/docker/index.pdf"},"kind":"page","language":"en","title":"What is Docker?","url":"https://engineer.company/glossary/docker/","version":1}