What Is a Container? Run Applications Consistently in Isolation
A container is a way to package an application process and the files it needs, then run it apart from other processes using features of the host operating system. Unlike a virtual machine, it does not normally boot a separate operating-system kernel for each workload. An image can therefore reduce differences between development, test, and deployment environments, but a container does not automatically isolate every host resource or preserve data.
What Is a Container? Run Applications Consistently in Isolation
A container is a way to package an application process and the files it needs, then run it apart from other processes using features of the host operating system. Unlike a virtual machine, it does not normally boot a separate operating-system kernel for each workload. An image can therefore reduce differences between development, test, and deployment environments, but a container does not automatically isolate every host resource or preserve data.
How are an image and a container different?
An image is a read-only package of files and default settings needed to start an application. A running container is the process and execution environment created from that image. One analogy is that an image is a prepared kit of instructions and ingredients, while a container is the work actually running from that kit. The image itself does not change while it runs. Starting the same image more than once creates separate containers.
A container starts from the image's filesystem layers. Writes made while it runs usually go into a container-specific writable layer. Deleting the container can delete that layer too. Store data that must outlive a replacement—such as database files or uploads—in a volume or external storage instead. Do not assume that data survives because you recreated the container; check where it is stored and how it is backed up.
What does a container isolate?
A Linux container is not a small virtual computer with its own kernel. It is a process running on the host Linux kernel. A container engine combines features such as Linux namespaces and control groups, or cgroups, to separate what a process can see from what it can use.
**Namespaces** give groups of processes different views of resources such as processes, network interfaces, and mounted filesystems. A PID namespace, for example, shows processes container-specific process IDs; a network namespace can provide separate network devices and routing configuration.
**Cgroups** organize processes hierarchically and account for or limit resource use such as CPU and memory. If limits are absent or are not applied by the execution environment, a container process can use too much of the host's resources.
**Filesystem layers and mounts** provide image files to the container and separate runtime changes from the image. Mounting a host directory crosses that isolation boundary: host files may become visible or writable inside the container, so inspect every shared path.
The diagram simplifies the responsibilities. A real implementation may separate the engine, a higher-level runtime, a low-level runtime, and the kernel into different components.
Image (filesystem layers and execution settings)
│ engine creates runtime configuration
▼
Isolated process ── namespaces: separate resource views
├── cgroups: limit/account resource use
└── host Linux kernel: system calls and hardwareNamespaces and resource controls do not solve every security problem. Containers normally share the host kernel, so kernel vulnerabilities, excessive privileges, unsafe device or host-path mounts, and an exposed container socket can weaken the boundary. Docker's security documentation also treats kernel support, capabilities, access controls, mounts, and configuration as parts of the security picture. Do not treat a container as equivalent to a virtual machine with a separate kernel boundary.
How does this differ from a virtual machine?
A virtual machine (VM) receives virtual hardware from a hypervisor and boots its own operating-system kernel. Containers share the host kernel while separating user-space files and access to resources. Because containers do not boot another kernel for every workload, they are often lighter to start and make it easier to run many application processes on one host. The trade-off is that they depend on the shared kernel's version and features, and their isolation and operating model differ from those of VMs. In practice, teams often run containers inside VMs to combine infrastructure boundaries with application packaging.
Docker documents that Docker Desktop on macOS and Windows uses a managed Linux VM to run Linux containers. Therefore, “a container shares the host kernel” describes the usual Linux-host model. Windows containers, virtualization-based runtimes, and managed development environments may use different kernel or virtualization arrangements; state the platform when it matters.
| Choice | May fit when | Main considerations |
|---|---|---|
| Container | You want to reproduce an application across environments and start or replace it quickly | Shared host kernel, image and secret handling, resource limits, and separate persistent data |
| Virtual machine | You need a separate guest OS or kernel, or a stronger isolation boundary | Guest OS patching and boot operations, resource use, and deployment unit |
| Containers inside VMs | You want VM-level host boundaries and image-based application deployment | Operating patches, observability, networking, and storage at both VM and container layers |
There is no universal answer that one option is “safer” or “faster.” Choose using your threat model, operating-system requirements, startup and scaling needs, and the operational work your team can own.
How does an application run in a container?
Suppose a Node.js service works on a developer's laptop but fails on a deployment server because library versions differ. The team builds an image containing the application code, required runtime and libraries, and a default command. It stores the image in a registry. A container engine or platform in each environment retrieves the image and starts a process from it. Runtime settings can specify ports, environment variables, resource limits, and storage mounts.
An image helps make the software input consistent, but it does not guarantee complete reproducibility. A tag may later point to a different image, and external databases, DNS, secret values, host kernels, and CPU architectures can also affect the outcome. If a deployment must use specific image contents, record and verify the image digest and its provenance, signatures, or other validation. Do not bake configuration secrets into the image.
What should you check when operating containers?
**Image source and identity:** Check who publishes an image and how it is built. Understand whether a tag can move; consider pinning a verified digest for production releases.
**Privileges and isolation:** Grant only required permissions. Avoid privileged mode, sharing host namespaces, or mounting sensitive host paths by default. A container runtime socket can grant powerful control, so do not expose it to workloads casually.
**Resource limits and observability:** Set CPU and memory requests or limits to fit the service, and monitor use, restarts, and exit reasons. Limits do not replace capacity planning; values that are too low can degrade performance or cause out-of-memory termination.
**Data lifetime:** Store data that must survive container replacement on persistent volumes or external services, and separately verify that backups can be restored.
**Platform boundary:** Record whether the workload is a Linux or Windows container, whether the development tool uses a VM internally, and which runtime and kernel combination is in use.
The central idea is not “a small VM,” but an application process started from an image and separated using operating-system features. Images can make deployments more consistent; safe operations still require deliberate choices about the shared kernel, privileges, resource limits, and data storage.
References
[Docker Learn: What is a container?](https://docs.docker.com/learn/content/what-is-a-container/)
[Docker Engine security](https://docs.docker.com/engine/security/)
[Linux kernel documentation: Control Group v2](https://docs.kernel.org/admin-guide/cgroup-v2.html)
[Open Container Initiative overview](https://opencontainers.org/about/overview/)
[Linux man-pages: namespaces(7)](https://man7.org/linux/man-pages/man7/namespaces.7.html)