Table of Contents
Table of Contents
Further Reading
What Does Docker Mean?
Docker is a platform that simplifies building, packaging, and running applications inside containers. Containers bundle code with its dependencies for a consistent environment.
Teams build an image once and run it anywhere. That reduces environment headaches and improves portability across development, testing, and production.
How Docker Works
- Write a Dockerfile: list the base image, dependencies, and commands.
- Build an image: Docker creates a layered, read-only image.
- Push to a registry: store and version the image.
- Run containers: start isolated instances from the image anywhere.
Here is a simple Dockerfile for a Playwright test suite:
Docker vs. Virtual Machines
Why Docker Matters
- Consistency: apps behave the same on any infrastructure
- Efficiency: shared kernels make containers lighter than VMs
- Scalability: containers start and stop quickly
- Ecosystem: registries, orchestration, and developer tools support it
- Reproducible tests: every environment uses the same image
Docker and Kubernetes
Docker builds and packages images. Kubernetes orchestrates containers across clusters, handling scheduling, scaling, and recovery.
Modern Kubernetes runs containers with runtimes like containerd or CRI-O. Images built with Docker follow OCI standards, so they run on those runtimes unchanged.
Real-World Example
A B2B SaaS team packages a microservice into a Docker image and pushes it to a registry. QA uses that image for automated tests, staging for integration checks, and production for deployment.
The team also packages its Playwright suite as an image. Testkube runs that image in the staging cluster, so tests and app share the same environment.
How Docker Relates to Testkube
- Image-based tests: any test tool packaged in an image can run in a Testkube workflow
- Isolated pods: each run starts from a clean container
- Consistent environments: the same image runs locally, in CI, and in clusters
- Custom tooling: bring your own images for specialized tests
Best Practices for Docker Images
- Use small base images: faster pulls and fewer vulnerabilities
- Pin versions: avoid surprise changes from latest tags
- Use multi-stage builds: keep build tools out of runtime images
- Scan images: catch vulnerabilities early
- Run as non-root: limit damage from compromises



