"Appendix: Why we use containers"
This is an optional appendix. The course works end to end without a container. This page is here if you want to understand what one is, or if you want to try one for this course next: see Set up a container.
Operating systems and portability
Windows, macOS and Linux are operating systems: the main software that runs a computer and everything on it. They each behave a little differently. That makes written instructions long and fragile, because "do this" changes depending on whose computer you are on.
One way teams avoid that is to give every developer the same small computer to work in. It runs inside your own computer, as if it were an app. That sounds odd, so here is a familiar example.
Have you seen people play old Nintendo games on a laptop? Those games were made for a small console that plugged into a TV. Its chips were completely different from the chips in a laptop, so a laptop cannot run those games directly. The two speak different machine languages.
What works is a program called an emulator. It makes the laptop pretend to be the old console, and the old game runs as if it were on the real thing. A computer can pretend to be another kind of computer, even an older one.
A container is a lighter trick
A container works in the same spirit. It is a pretend computer running inside your real one, set up exactly the way you need it: for example, running Linux (the operating system most websites run on) with Python installed and a friendly terminal ready. Technically it is not an emulator. It is a lighter trick called a container, which starts faster and uses less of your computer. The picture to keep in mind is a computer inside your computer. Because everyone gets the identical one, every command works the same way for everyone.
The folder on the edge of the picture is the link between the two sides. It is one folder, and both the host computer and the container see it. You write your code in your editor on your own computer, and you run it in the container's terminal.
Two more facts about a container:
- It is safe. Whatever you do inside it cannot damage the files on your own computer.
- It is disposable. You can close it and start a fresh one any time. Your work is not lost, because you keep your files in a normal folder on your own computer that the container borrows while it runs.
Recall
What is a container?
Show the answer
A small computer inside your computer, set up with exactly the software a project needs.
Why professionals use them
A team can hand everyone the same ready-made environment, so a new developer sets up in one command rather than a day of installs. A programmer with several projects can keep each one in its own container, with exactly the software that project needs, and the projects do not interfere with each other.
For this course, uv does the Python install so simply that a container is extra work rather than help. The appendix is here for anyone who wants to meet them anyway.
Next: Set up a container.