Containers
It works on my laptop
Shard Garden's race server works on Remy's laptop. On a production server, with a different version of Node and its libraries, it crashes.
A container packs the program with everything it needs, so it runs the same everywhere.
An image and a container
Docker's guide defines a container image as "a standardized package that includes all of the files, binaries, libraries, and configurations" a program needs. "Images are immutable": once made, they "can't be modified."
A container is what runs from an image: "an isolated process with all of the files it needs to run."
Quick check
Remy packages the race server. Which one can never be changed once it is made?
- The image
- The container
- Both change all the time
Show the answer
The image
Images are immutable. A change means building a new image, which gets a new version.
Four promises
Docker lists what a container gives:
- Self-contained"everything it needs to function with no reliance on any pre-installed dependencies".
- Isolated"Minimal influence on the host and other containers".
- Independent"Deleting one container won't affect any others."
- PortableThe one on a laptop "will work the same way in a data center".
Read the Dockerfile
1FROM node:22-slim2WORKDIR /app3COPY package*.json ./4RUN npm ci5COPY . .6CMD ["node", "server.js"]
Which line starts the race server when a container runs?
- CMD ["node", "server.js"]
- RUN npm ci
- FROM node:22-slim
Show the answer
CMD ["node", "server.js"]
FROM picks a base image. RUN "actually runs a command" while the image is built, here installing packages. CMD runs nothing at build time: it sets the command a container starts with.
Not a whole computer
A virtual machine is "an entire operating system with its own kernel, hardware drivers, programs, and applications."
A container is just a process. Many containers "all share the same kernel", the core of the host's operating system, so they start in moments and one server can run many.
Quick check
Why can one server run many more containers than virtual machines?
- Containers share the host's kernel instead of each running a whole operating system
- Containers have no files
- Virtual machines cannot run games
Show the answer
Containers share the host's kernel instead of each running a whole operating system
Each virtual machine carries a full operating system. Containers share one, so each is much lighter.
One image, every environment
The pipeline builds the race server's image once and tags it, for example race:2.14.0. Staging runs that image. When staging passes, production runs the very same image.
Quick check
After staging passes, the pipeline should build a fresh image for production.
- True
- False
Show the answer
False
A fresh build could pick up different library versions. Production runs the exact image staging tested.
To every player at once?
The image is tested. Sending it to every player at the same moment is still a risk.
Bolt says: Next: canary releases.
Fact-checked 12 October 2026
- Docker: What is a container? docs.docker.com
- Docker: What is an image? docs.docker.com
- Docker: Dockerfile reference docs.docker.com