Docker Typing Drills
Docker splits your typing between two grammars: UPPERCASE Dockerfile instructions and hyphen-dense CLI commands. Fluency in both means container workflows stop interrupting your development flow.
Two Grammars, One Workflow
Dockerfiles capitalize their instruction verbs — `FROM`, `RUN`, `COPY`, `CMD` — creating caps bursts like SQL's, followed by lowercase arguments with special forms: image tags with colons (`node:20-alpine`), stage aliases (`AS builder`), and the JSON-array CMD syntax (`["node", "dist/index.js"]`) that mixes brackets, quotes, and commas in one line. Multi-stage builds repeat the pattern with `--from=builder` flags bridging stages.
The CLI side is flag-heavy even by terminal standards: `docker run -d --name api -p 8080:8080 --env-file .env` chains short flags, long flags, and colon-separated port mappings. Cleanup commands stack flags (`system prune -af --volumes`), and exec sessions end in shell paths. Drilling both the file format and the commands builds complete container fluency.
Key Drills for Docker:
- Caps instructions: `FROM`, `RUN`, `COPY` start every Dockerfile line. Hold Shift through the word like SQL keywords.
- Colon-separated pairs: Image tags and port maps both use colons: `node:20`, `8080:8080`. Make the pattern automatic.
- Flag stacking: Drill `-d --name x -p` sequences — real docker run commands chain five or more flags.
Sample Drill: Multi-stage Dockerfile
Building production node servers with multi-stage layers.
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-alpine AS runner
WORKDIR /app
COPY --from=builder /app/dist ./dist
CMD ["node", "dist/index.js"]
All 14 Docker Drills
Every session picks a random drill from this pool. Use the difficulty filter above to stay on easy warm-ups or jump straight to the hard ones.
-
Container Lifecycle Commands easy
Running, inspecting, and cleaning up containers from the CLI.
-
Reclaim Disk Space easy
Inspect Docker disk usage and prune old images, volumes and cache.
-
Inspect Running Containers easy
Format ps output, grep env vars and read the health status.
-
Python App Dockerfile easy
A slim Python image installing requirements before copying source.
-
Dockerignore File easy
Keep the build context small and secrets out of the image.
-
Multi-stage Dockerfile medium
Building production node servers with multi-stage layers.
-
Non-root Node Image medium
Production Node image running as the node user with a HEALTHCHECK.
-
Compose Healthy Depends medium
Start the API only after Postgres reports healthy.
-
Multi-arch Buildx medium
Build and push amd64 and arm64 images with a registry cache.
-
Compose Workflow medium
Rebuild, tail logs, open psql, run a migration and tear down.
-
Go to Distroless hard
Cache Go modules with BuildKit mounts and ship a static nonroot binary.
-
Python Venv Multi-stage hard
Build a virtualenv in one stage and run it as a system user in another.
-
Compose Secrets and Profiles hard
A worker service with file secrets, resource limits and a profile.
-
Hardened Container Run hard
Run read-only with dropped capabilities, then inspect and snapshot it.
The Symbols That Slow You Down
The keystrokes below are where Docker typing speed is won or lost. Key positions shown for QWERTY — the pattern transfers to any layout, just on different physical keys.
| Symbol | Used For | Keys | How to Drill It |
|---|---|---|---|
| --flag | Long flag | Two hyphens, then word | `--name`, `--env-file`, `--rm` — double-dash flags chain five deep in real docker run commands. |
| : | Tag / port pair | Shift+Semicolon | `node:20-alpine`, `-p 8080:8080` — colon-separated pairs in both image names and port maps. |
| \ | Line continuation | Unshifted, above Enter | Dockerfiles continue lines with a trailing backslash — an end-of-line reach that must be reflexive. |
| FROM | Instruction caps | Hold Shift through the word | Dockerfile verbs are uppercase — the same caps-burst discipline as SQL keywords. |
| ["…"] | JSON-array form | Brackets as Shift+[ Shift+], quotes as Shift+Apostrophe | `CMD ["node", "dist/index.js"]` mixes brackets, quotes, and commas in one line. |
| $() | Build-time substitution | $ as Shift+4, then () as Shift+9 and Shift+0 | Variable expansion inside RUN commands and compose files. |
Common Docker Typing Mistakes
- ✗ Dropping the trailing backslash on continued Dockerfile lines — the build fails on the next line.
- ✗ Typing single hyphens for long flags (`-name` versus `--name`) — train the double-dash as its own stroke pair.
- ✗ Forgetting the colon in port mappings: `-p 8080 8080` does something entirely different.
What's a Good Docker Typing Speed?
Docker typing alternates caps bursts and flag chains: 30–45 WPM with 96%+ accuracy is solid working speed, and full `docker run` invocations should flow without re-reading.