


- Define what a container is and how it isolates a single application.
- Explain why containers are popular (speed, portability, consistency).
- Cover storage and networking basics for containers.
What is a container?
A container is a lightweight, self-contained environment for running one application or service. It bundles the application code, runtime, libraries, and configuration so the app runs predictably across environments. Crucially, a container does not include a full guest OS. Instead it shares the host machine’s OS kernel—the component that schedules CPU, manages memory, and controls hardware access.
Images and Dockerfiles
Every running container is an instance of an image. An image is an immutable, read-only snapshot that defines the filesystem, runtime, and the command to run. You can launch many containers from the same image. Images are usually built from a Dockerfile (or equivalent). A Dockerfile is a small declarative script telling a container engine how to assemble the image. Docker is a widely used tool for building and running images; alternatives include Podman and runtimes like containerd. Example Dockerfile:

Why containers matter
Containers address several practical needs for modern development and operations:
- Fast startup: No guest OS to boot, so apps can start in seconds—useful for development and autoscaling.
- Consistency: Images provide identical runtime environments across machines, reducing “works-on-my-machine” problems.
- Portability: Build an image once and run it wherever the container runtime is supported.
- Isolation: Containers isolate the app and its dependencies from other host applications.

Limitations and trade-offs
Containers share the host kernel, so their isolation is not as strong as a VM’s hardware-level separation. A kernel-level vulnerability could potentially affect other containers or the host. Containers are commonly used for single services; running large monoliths is possible but may require different patterns and operational controls.Containers share the host kernel. For multi-tenant or high-security scenarios, harden the host, minimize the attack surface, or consider VMs for stronger isolation.
Data persistence
By default, containers are ephemeral: files written to a container’s internal filesystem are lost when the container is removed. Treat the container’s writable layer like a temporary workspace.
Use volumes to persist important data. Volumes exist outside the container’s writable layer, so removing a container won’t delete the stored data.
Quick quiz
Which statement is true? A. A container includes its own full operating system.B. Containers always save their data, even after they’re deleted.
C. A container runs in an isolated environment using the host’s operating system kernel. Answer: C. Containers run in isolated spaces but share the host kernel. A is false (containers don’t include a full guest OS). B is false unless you attach persistent storage such as volumes.
Summary

- Containers typically run a single app or service in an isolated environment.
- They share the host OS kernel instead of bundling a full guest OS.
- Containers start quickly, behave consistently across environments, and avoid dependency conflicts.
- Containers communicate over virtual networks and can be orchestrated at scale with tools like Kubernetes.
- Use volumes to persist data long-term.

Links and references
- Docker — https://www.docker.com/
- Kubernetes Basics — https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/
- Podman — https://podman.io/