DEV Community

Cover image for I built a free game to learn Linux & Docker in your browser 🐳🎮
Doode
Doode

Posted on

I built a free game to learn Linux & Docker in your browser 🐳🎮

Most people learn Docker by pasting commands from a tutorial into a real machine. It works, right up until it doesn't, and then the terminal feels like a minefield.

I wanted somewhere beginners could type the real commands, get things wrong and get instant feedback, with nothing to install and nothing real to break. So I built DockerLinux.

What it is

A simulated Linux machine with Docker, in a browser tab, wrapped in a small game:

  • Missions and XP: each level is a checklist of small tasks. Finish them to level up, unlock achievements and, at the end, download a certificate.
  • A lesson after every task: run pwd and it tells you what /root/app actually means. Run docker run -d and it explains what "detached" is.
  • A quiz at the end of each level, and your progress is saved in your browser.
  • Works on phones too, with on-screen Tab/↑/↓ keys.

9 levels, from zero to Compose

It starts with the absolute basics (pwd, ls, cd, hidden files) and ends with building your own image and running a multi-container app with docker compose up. The last level is a sandbox where you can play freely.

Stuck? Never for long

Hints come in three steps: the idea, then the syntax, then the answer. Each step costs a bit of XP, so you're nudged to think first, but you're never left stuck.

How it works under the hood

There's no real VM or container behind it. It's all JavaScript in your browser:

  • A tiny shell: a tokenizer that understands quotes, &&, ||, ; and > / >> redirects, plus an argument parser for flags like -d, --name web-server and -p 8080:80. (Pipes aren't supported yet. They're on the list!)
  • A virtual file system with real paths, so cd .., ls -la, cat, mkdir and echo "hi" > file.txt behave the way you'd expect.
  • A simulated Docker daemon: images you can pull, a container lifecycle (run, stop, start, rm, logs), name and port conflicts, volumes, networks, docker build that reads the Dockerfile in the virtual file system, and docker compose up that reads the YAML. curl localhost:8080 even answers once a container publishes that port.
  • Levels are data: each task has a check(ctx) function that runs after every successful command, so the game reacts to what you actually did rather than to one exact string.
{
  desc: "Start an Nginx web server container in the background, named 'web-server'",
  hints: ['`docker run` creates and starts a container...', 'docker run -d --name <name> <image>'],
  hint: 'docker run -d --name web-server nginx',
  check: (ctx) => runningContainer(ctx, 'web-server', 'nginx'),
}
Enter fullscreen mode Exit fullscreen mode

The UI is Vue 3 + Vite + Tailwind. Terminal output is rendered as structured segments (no v-html anywhere), which made it possible to ship a strict Content Security Policy. It's hosted on Cloudflare Workers, with D1 (SQLite) for the optional newsletter signup.

Try it

👉 dockerlinux.com: free, no account needed.

I'd love feedback, especially from people who are just starting out:

  • What confused you?
  • Which command did you expect to work that didn't?
  • What should the next levels cover: permissions, pipes and grep, processes, environment variables, and multi-stage builds?

And if you're experienced with Docker: where does the simulation behave differently from the real thing in a way that could mislead a beginner? That's the feedback I value most. 🙏

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.