Building your own container runtime reveals Docker's weirdest secrets

Docker Is Weird

After starting his own container runtime for fun, the author shares surprising lessons: containers are just processes with kernel restrictions, images are folders that Docker chroots into, and Go—Docker's runtime language—lacks fork and needs a C workaround for single-threaded syscalls. Docker also typically requires root, though rootless networking means reimplementing the stack in userspace. Writing your own version of a tool is a great way to learn it.

Instead, containers are really 5 different linux kernel features in trenchcoat.
  1. shykes

    Hi, I'm the creator of Docker and came across this post. It's always fun to see other engineers think about how you designed a system. I haven't been involved in developing Docker in many years, but it's a fun trip down memory lane.

    I'm happy to answer any questions you may have.

  2. vbezhenar

    What made Docker unique IMO is not the container technology itself. I used chroot 20 years ago and it worked just fine. Yes, no network namespaces; no process namespaces, but I don't even think these are that important.

    What made Docker unique were there things:

    1. Dockerfile concept. Building images layer by layer. Caching layers. Everything in a single file. It made possible to iterate on image quickly. It made possible to implement CI builds efficiently.

    2. Docker network registry concept. Putting universal images onto a server and share them with the world.

    3. Momentum. A lot of software that was traditionally complicated to deploy, suddenly appeared in docker servers. I remember how fascinated I was, when I could deploy wordpress website with tiny docker-compose. And how contained it was. I could just delete every trace of it from my host. I always felt uneasy installing various things onto my host and docker just solved that uneasiness.

  3. slowin

    I prefer Podman most of the time, but Docker is/was amazing and a great DX put on top of the so called "5 different linux kernel features in trenchcoat". That's the selling point, it's super lightweight and takes full advantage of the OS features that were already there (or being developed) but were awkward to use and required tons of specialized knowledge.

  4. suprjami

    Always nice to see someone demystifying a complex thing by learning the building blocks it's made from.

    Knowing this, you might find rootless Podman's fork-exec method of starting containers to be more sensible. I certainly do. No root, no daemon, no socket.

    If you want to learn more about the Linux Kernel namespaces which work together to make a container, this LWN series is really good: https://lwn.net/Articles/531114/

  5. jlhawn

    > Docker’s container runtime, runc, is written in Go.

    I worked at Docker from 2014-2019. The most important part is actually written in C.

    [I wrote a whole comment here about to explain how the hack works because I was too fixated on how technically incorrect "written in Go" is. Then I went back to read the rest of the article only to see that the paragraph immediately after this kind of explains it in its own way! Let that be a lesson to always finish reading the article before posting about it.]

  6. j16sdiz

    Every statement in the article make me ask: "what's weird about it?"

    Everything in that list feel natural when you know how things evolves over many years. Maybe it is just me getting older and less curious.

  7. tyingq

    Poke around in bocker[1]. For technical people, it makes the same points the article makes in a way that's very clear.

    [1] "Docker implemented in around 100 lines of bash"

    https://github.com/p8952/bocker

  8. andreygrehov

    I created Range (for fun). No daemon. No root.

    A few cool tricks:

    `range shell python:3.12` - opens a shell image without pulling the entire image.

    `range shell ubuntu --commands` - you are in Ubuntu. Type any command Ubuntu doesn't have and it comes from the image that has it. On the fly.

    `range run --network none ubuntu` - network-isolated sandbox

    range run ebs://snap-... -- cat /etc/os-release - opens an EBS snapshot with no EC2 instance

    Another cool trick:

    `range run python:3.12 --mount hf://moonshotai/Kimi-K2-Instruct:/model -- du -sh /model` says 959G instantly :)

    Check it out here - https://getrange.sh

    Most importantly, Range doesn't need any daemon, any container runtime, any registry or any image conversion. One binary only. On a Mac it boots its own tiny Linux VM per session, and on Linux it uses KVM.

  9. sarocu

    IMO packaging is the best part of the Docker ecosystem and what really made container workloads take off

  10. colinmarc

    Lots of positive stuff in this thread which I won't bother repeating. Instead, I'll add a few ambivalent points:

    - Today, a lot of functionality still in Docker has been upstreamed into the (Linux) kernel, so containers can be much simpler (and rootless). Docker is still carrying around some of that cruft, which is what makes it slower and heavier than Podman.

    - As a devex technology, Docker/containers have been massively successful, but not as infrastructure. Containers never became secure enough to run multitenant workloads without some other form of isolation, so they ended up being redundant with KVM (or gVisor, or a similar second layer) in production a lot of the time.

    That second contradiction led to lots of inefficiency. For example, on Google App Engine, for years when you ran a deploy it would create a VM just to run a single container.

More from this day

2026-10-23