Free sample lesson ยท Kubernetes vs Docker: When to Use Each
What Docker actually does
Lesson 1 of the Wondering course Kubernetes vs Docker: When to Use Each
The problem Docker solves
An app rarely runs alone. It needs a specific language version, libraries, and system packages.
When those pieces differ between your laptop and the server, the app breaks.
Docker fixes this by packaging the app and all its dependencies together.
- App alone
- Docker package
The result runs consistently anywhere the container runtime exists.
Images and containers
Docker has two core objects, and mixing them up causes confusion.
An image is the packaged bundle: the app plus its dependencies, saved in a standard format.
A container is a running instance of that image.
- Image
- Container
One image can start many containers. The image stays fixed; containers are the live copies you actually use.
The OCI standard
Docker images are OCI-compliant. OCI is the open standard that describes how a container image is laid out.
That standard is why an image is portable.
Because the format is shared, the same image can be pulled and run by other OCI-compliant tools, not only by Docker.
- OCI standard: The open standard describing how a container image is laid out.
- Image: The portable bundle of app plus dependencies in that format.
- Container: A running instance started from the image.
Each layer sits inside the one above it.
Think of it as an agreed shipping container size that every port can handle.
Build, then run
Two commands carry most of the work.
docker build turns your app and its stated dependencies into an image.
docker run takes that image and starts a container from it.
- App plus deps: Start with your app and the dependencies it needs.
- docker build: Build packages everything into an OCI-compliant image.
- docker run: Run starts a container from that image.
- Run anywhere: The same image behaves the same on any machine.
Build once, then run the same image on your laptop, on a teammate's machine, or on a server. Nothing about the package changes.
What to hold on to
Docker packages an app with everything it needs so behaviour does not depend on the host.
The image is the package. The container is the package running.
Build makes the image. Run makes the container.
- App plus dependencies: Everything the app needs to run.
- Image: The package itself.
- Container: The package running.
- OCI standard: Lets the package travel between machines and tools.
Because the image follows the OCI standard, that same package travels between machines and tools without being rebuilt.
Check yourself
Docker helps an app behave consistently by packaging it with its dependencies.
- True
- False
Answer: True
Docker packages the app with its language version, libraries, and system packages. This reduces differences between the laptop and the server.
The saved application package is an _____; its live running instance is a _____.
Answer: The saved application package is an image; its live running instance is a container.
The image is the fixed packaged bundle. A container is the live instance started from that image, so each blank has a distinct role.
Why can the same OCI-compliant image be used by Docker and other compatible container tools?
- Because compatible tools share the OCI image format
- Because every host automatically has identical dependencies
Answer: Because compatible tools share the OCI image format
OCI provides a shared image format. Because compatible tools understand that format, the same image can be run without rebuilding it for each tool.
Keep going
This is lesson 1 of 9 in Kubernetes vs Docker: When to Use Each. Next up:
- Docker Compose for local development
- Docker Swarm: built-in orchestration
- How Kubernetes works
- Self-healing and auto-scaling
- Advanced deployments and multi-team isolation
Wondering turns any topic into short lessons you can read, watch, or listen to, with practice questions and an AI tutor.