Course outline · 0% complete

0/29 lessons0%

Course overview →

Why software breaks on other machines

lesson 1-1 · ~12 min · 1/29

Why software breaks on other machines

You already know the terminal and git. Git moves your code between machines perfectly, every byte identical. And yet a program that runs fine on your laptop can crash the moment it lands on a server or a teammate's machine.

That is because a program never runs alone. It runs inside an environment: the operating system, the language version (Python 3.12 vs 3.8), the installed libraries, the database version, and configuration like environment variables. Git ships the code but none of that.

When any piece of the environment differs, the same code can behave differently. That is the famous bug report: "works on my machine."

What actually differs

A concrete example. You build an app on your laptop and it works. You copy it to a server with git clone and it dies. Nothing in the code changed. What changed is everything around it:

  • OS: Ubuntu 24.04 on your laptop, Debian 10 on the server
  • Language version: Python 3.12 vs 3.8, and your code uses a 3.12 feature
  • Libraries: you have requests 2.31, the server has 2.18
  • System tools: a font, a C library, or ffmpeg that only you installed
  • Config: an environment variable set in your shell but not there

Containers solve this by shipping the code together with its environment as one unit, so every machine runs the exact same thing.

The cost is bigger than one crash

The broken server is the dramatic version. The quiet, expensive version happens every week on real teams:

  • Onboarding: a new teammate spends their first days following a setup document ("install Python 3.12, then Postgres 16, then...") that is always slightly out of date
  • New servers: every extra machine you deploy to must be hand-configured the same way, and each one drifts a little over time
  • Ghost bugs: "works on my machine" issues burn hours precisely because the bug is not in the code, so reading the code cannot find it

Containers turn all three into a single docker run. That is why they went from niche tool to the default way software ships in about a decade: the whole industry was paying these costs by hand.

Code exercise · bash

Run this to see the mismatch laid out. It only prints text, but it is the exact situation containers were invented for: same code, two environments.

Code exercise · bash

Your turn: write the check a deploy script could run before shipping. The variables hold each machine's Python version. Compare them with an if statement: print "environments match" when they are equal, otherwise print exactly: environment mismatch: laptop 3.12 vs server 3.8

Quiz

Your app works locally but crashes on the server. Git shows the code on both machines is identical. Which explanation fits best?

Problem

One word: what do we call everything around your code that it needs to run, such as the OS, language version, libraries, and configuration?