It works on my machine
A developer says: "It works on my machine!" The tester says: "It does not work on mine."
The two computers are not the same. One has an old version of a tool. One has a missing file.
What if the program travelled with everything it needs, in one sealed box? This is the idea of a container.
Key words
| Word | What it means | Example |
|---|---|---|
| Container | A program running in its own sealed box with everything it needs. | |
| RAM | The fast memory a computer uses while a program runs. | A phone with 8 GB of RAM |
| Virtual machine | A whole pretend computer, running inside a real one. | |
| Operating system | The main software of a computer, such as Windows or Linux. | |
| Image | A saved package with a program and its files. You make many containers from one image. | |
| Containerisation | Packing software into containers so it runs the same everywhere. | |
| Registry | An online store of images that you can download from. | |
| Orchestration | Software that starts, stops, moves and watches many containers for you. | |
| Kubernetes | A popular platform that looks after containers. Its code is public. | |
| Replica | One of several identical copies of a container. | |
| Scaling | Running more copies when there is more work, and fewer when there is less. | |
| Health check | A small test that shows a container is still working. |
The cells students fill in are left blank in this preview.
What is a container?
A container holds a program and the files it needs. It runs apart from other containers.
You build a container from an image. One image can make 1 container or 100. They are all the same.
The best known tool is Docker. A file called a Dockerfile is the recipe that builds an image. It is a list of steps.
Quick check: containers
Have a go
Quick check: containers
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
A Dockerfile, line by line
| A line in the recipe | What it tells Docker |
|---|---|
| FROM python:3.12 | Start from an image that already has Python |
| COPY . /app | Copy my files into the folder /app inside the image |
| RUN pip install flask | Install a library my program needs |
| CMD ["python", "/app/main.py"] | When a container starts, run this command |
The cells students fill in are left blank in this preview.
Container or virtual machine?
| Container | Virtual machine | |
|---|---|---|
| What it is | One program in a sealed box | A whole pretend computer with its own operating system |
| Size (MB and GB are units of file size. 1 GB is 1000 MB) | Small: often a few hundred MB | Large: often many GB |
| Start time | Seconds | Minutes |
| Good for | Many small services | Running a different operating system |
The cells students fill in are left blank in this preview.
Container or virtual machine?
Have a go
Container or virtual machine?
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.