Lesson 1 of 86 min read
Why testers need containers
'It works on my machine' is the oldest excuse in software. Containers fix it by packaging an app with everything it needs, so it runs the same on a laptop, a CI runner and a server. For testers this means identical test environments, fresh databases in seconds and test suites that run anywhere. This lesson explains containers in plain words and shows where they appear in a QA job.
Key takeaways
- 1A container is an app plus its runtime, libraries and settings, packaged together and isolated from the rest of the machine.
- 2Containers are not virtual machines: they share the host's operating system kernel, so they start in seconds and use far less memory.
- 3Docker is the most common tool to build and run containers. Kubernetes is a system that runs many containers across many servers.
- 4For testers: spin up the app under test, a clean database or a browser grid with one command, then throw it away after the run.
- 5In CI, almost every pipeline step already runs inside a container. Knowing Docker lets you debug failures that only happen 'in the pipeline'.
The same test run, with and without Docker
WITHOUT DOCKER Tester A: Node 18, Chrome 120, Postgres 14 -> tests pass Tester B: Node 20, Chrome 124, Postgres 16 -> 3 tests fail CI runner: whatever is installed -> random failures
WITH DOCKER
Everyone runs: docker compose up
app -> image myapp:1.4.2
database -> image postgres:16 (fresh, seeded test data)
tests -> image mcr.microsoft.com/playwright:v1.48.0-jammy
Same versions on every laptop and in CI -> same results
After the run: docker compose down -v (everything removed)
Go deeper
Expert notes beyond the basics
- 01
What actually goes inside a container
A container holds the application code, the runtime (Node, Java, Python), system libraries and configuration files. It does not hold a full operating system kernel; it borrows the host's. That is why a container image can be tens of megabytes and start in under a second, while a virtual machine image is gigabytes and takes a minute to boot.
- 02
Where you'll meet Docker in a QA job
Running the app locally at a specific version to reproduce a bug. Starting a clean database before an automation run. Running Selenium Grid or Playwright browsers without installing them. Reading CI logs, where every job runs inside a container image. Testing a microservice in isolation with its dependencies mocked in other containers.
- 03
Docker vs Kubernetes in one sentence each
Docker builds images and runs containers on one machine. Kubernetes runs and manages many containers across many machines: it restarts crashed ones, scales them, rolls out new versions and routes traffic. Testers use Docker hands-on and mostly read Kubernetes.
Common mistakes to avoid
- - Thinking Docker is only a DevOps topic; testers use it every week for environments and browsers.
- - Treating a container like a long-lived server and making manual changes inside it.
- - Confusing containers with virtual machines and expecting a full desktop OS inside.
- - Ignoring CI failures that 'only happen in the pipeline' instead of reproducing them in the same image locally.
Try it yourself
Your team says automation results differ between laptops and CI. List 4 ways Docker could reduce that difference.
Write your answer on paper or in a sheet first, then compare.
Interview questions
How to answer like a confident QA engineer
- Q1
Why would a QA engineer use Docker?
Model answer
Mainly for consistent, disposable test environments. I can start the application, a database with known test data and the test runner itself with fixed versions, so results are the same on my laptop and in CI. It removes 'works on my machine' problems, lets me reset to a clean state for every run, and makes it easy to run browser grids or dependent services without installing them. It also helps me read and debug CI failures, because most pipeline jobs run in containers.
- Q2
What problems does containerisation solve for testing?
Model answer
Inconsistent environments, slow environment setup, and dirty test data. With containers every run uses the same versions, environments start in seconds, and they are thrown away afterwards, so each run starts clean.
- Q3
Is Docker the same as Kubernetes?
Model answer
No. Docker builds and runs containers, usually on one machine. Kubernetes orchestrates containers across a cluster: scheduling, scaling, self-healing and rolling updates. Kubernetes can run images built with Docker.
Knowledge check
+5 points
What is the main difference between a container and a virtual machine?
