gVisor Explained: Sandboxed Container Runtime Architecture
Containers make applications portable and efficient, but ordinary Linux containers still share the host kernel. That boundary is important when a platform runs customer code, build jobs, or other workloads it does not fully trust. gVisor is a sandboxed container runtime that changes how a workload’s operating-system interface is handled without requiring a separate guest operating system for every container.
Why gVisor Is Being Discussed
The container model makes it easy to package and start processes, including processes supplied by users, agents, or automated build systems. That convenience creates a security question: how much should an untrusted workload be allowed to interact with the host kernel? A namespace and a container runtime isolate many resources, but the workload still depends on the same kernel implementation as the host.
gVisor is one answer for platforms that want a stronger boundary while keeping familiar container images and orchestration tools. Its runsc runtime places an application kernel between a workload and the host. Teams evaluating it need to weigh that isolation model against application compatibility, operating cost, and the security of the full host configuration.
What Is gVisor?
gVisor is an application kernel: software that implements a Linux-like system interface for applications, but runs as a userspace process rather than as the host’s kernel. Its project overview describes gVisor as a layer of isolation between applications and the host operating system. The workload issues system calls as if it were using Linux; gVisor handles the supported calls inside its sandbox instead of passing every request directly to the host kernel.
The project supplies runsc, an Open Container Initiative (OCI) runtime. Container tools can ask it to create and run a container in a sandbox, allowing teams to reuse much of their existing image and deployment workflow. The OCI runtime specification defines container lifecycle operations and state; it is an integration contract, not a promise that a runtime provides a particular security boundary.
gVisor is not a new container image format, a container orchestrator, or a full virtual machine. It does not boot a separate Linux guest kernel for each workload. Instead, it interposes its own userspace kernel and other sandbox components between application processes and host resources.
The Problem gVisor Solves
Linux containers typically combine namespaces, control groups, filesystem and network configuration, and kernel security controls. These features provide useful separation and resource limits, but the container process still reaches the shared host kernel through system calls. A kernel flaw reachable from a container can therefore threaten the host or other workloads, depending on the flaw and the host’s configuration.
This model is often appropriate for trusted applications operated by one team. It may be less attractive when a service executes arbitrary build steps, code submitted by different customers, or short-lived automation with a broad dependency surface. The alternative of using a virtual machine provides a guest-kernel boundary, but introduces a virtual machine manager, a guest kernel, and additional lifecycle and resource management.
gVisor targets a middle ground: preserve container-oriented packaging and familiar runtime interfaces while narrowing the workload’s direct interaction with the host kernel. It reduces reliance on host-kernel system-call behavior; it does not eliminate host kernel use or make a workload harmless by default.
How gVisor Works
When a container is started with runsc, the runtime sets up a sandbox and its processes. The application’s system calls and memory faults are intercepted by a platform layer and handled by gVisor’s Sentry, the userspace application kernel. The architecture guide explains how the Sentry implements Linux behavior in Go and keeps its own view of processes and other kernel-managed state.
The Sentry does not simply forward every application system call to Linux. It implements supported behavior itself, and makes a more limited set of host system calls for its own needs. This separation reduces the workload’s direct exposure to the host kernel interface, but the Sentry, runtime, host kernel, and configuration are all still part of the security design.
Filesystem access is another important boundary. A Gofer component can mediate access to files on the host, so the sandbox does not need unrestricted access to the host’s filesystem namespace. The exact mount and access configuration still matters: a mounted secret, writable host directory, or exposed socket grants capabilities regardless of the runtime’s syscall model.
The platform layer determines how the workload’s execution is trapped and delivered to the Sentry. gVisor supports different platform approaches for different environments, and the available choice depends on host capabilities and the runtime build. A platform choice can affect compatibility, performance, and operational requirements; it should be selected and tested using the official platform guide.
| Concern | Standard OCI runtime such as runc |
gVisor runsc |
Firecracker microVM |
|---|---|---|---|
| Main boundary | Host-kernel namespaces and controls | Userspace application kernel plus sandbox configuration | Hardware-assisted virtual machine with a guest kernel |
| Workload system calls | Handled by the host Linux kernel | Supported calls handled by the Sentry; limited host calls remain | Handled by the guest kernel |
| Guest operating system | No separate guest kernel | No separate guest kernel | Boots a guest operating system |
| Container tooling | Common low-level runtime interface | OCI runtime that integrates with container tooling | Requires a VM or platform supervisor; containers may run inside the guest |
| Compatibility | Broad for applications supported by the host kernel | Depends on gVisor’s Linux interface and enabled features | Depends on the guest kernel, devices, and VM configuration |
| Operational trade-off | Lowest additional isolation layer; host-kernel attack surface remains | Extra runtime layer and compatibility/performance testing | Strong VM boundary, with guest boot and VM lifecycle to manage |
| Typical fit | Trusted, compatible workloads | Container workloads needing more separation without a guest OS | Workloads that need a guest-kernel boundary |
These are different isolation designs, not a simple ranking. Actual risk depends on the host, runtime and platform configuration, privileges, mounts, network policy, and the code being executed. For a guest-kernel boundary and its trade-offs, see Firecracker microVM architecture.
Components and Key Concepts
runsc: The runtime that connects container lifecycle requests to gVisor. Docker and Kubernetes can use it, but each environment needs its runtime integration configured.- Sentry: The userspace application kernel. It provides the Linux-like behavior that the sandboxed application expects, within the scope of gVisor’s implementation.
- Platform: The mechanism that traps workload execution and routes system calls and memory faults to the Sentry. Different platform options have different host and performance characteristics.
- Gofer: A separate component that can proxy filesystem operations. It is part of the path between a workload and host files, so its permissions and the paths it can see must be constrained.
- Sandbox configuration: Runtime options define capabilities such as networking, filesystem mounts, and resource limits. A sandbox cannot revoke access that an operator explicitly grants through a mount, device, or credential.
- OCI integration: The runtime follows container lifecycle conventions so existing systems can launch containers through
runsc. The OCI interface standardizes runtime behavior; it does not standardize the runtime’s internal sandbox architecture.
This separation is useful when reasoning about risk. gVisor reduces how much of the host kernel interface an application can directly exercise, but the runtime still runs on a host kernel and needs a secure setup, updates, monitoring, and least-privilege configuration.
Real-World Use Cases
Multi-tenant application platforms can use gVisor when customers supply code or container images and the platform wants an additional isolation layer while retaining container-oriented deployment.
Build and test services can sandbox steps from unfamiliar repositories. The runtime does not replace limits on build credentials, outbound network access, cache contents, or CPU and memory consumption.
Agent and automation systems can execute tools or generated code in disposable containers. gVisor can reduce direct exposure to the host kernel, but the application still needs to limit what files, credentials, and network endpoints each task can reach.
Kubernetes clusters can configure gVisor as a runtime for selected workloads. This requires cluster-level runtime and node configuration; adding a runtime binary to a worker does not automatically move every pod into a gVisor sandbox.
Getting Started with gVisor
Use a supported Linux host and install runsc by following the platform-specific gVisor installation guide. The Docker quick start describes the Docker integration. Once the runtime is installed, register it with Docker and restart the daemon:
sudo runsc install
sudo systemctl restart docker
Restarting Docker affects workloads managed by that daemon, so plan it as an operational change rather than running it blindly on a production host. Confirm Docker lists the runtime, then run a test container explicitly with runsc:
docker info --format '{{json .Runtimes}}'
docker run --rm --runtime=runsc hello-world
For an application image, substitute its name and required command:
docker run --rm --runtime=runsc your-image:tag your-command
If the daemon cannot find the runtime, check that runsc is installed at the location Docker expects, that sudo runsc install completed, and that Docker was restarted. If a workload fails only under gVisor, compare its system calls, filesystem behavior, networking, and runtime options with the supported application compatibility information. Do not infer security from a successful startup alone; review mounts, privileges, credentials, network exposure, and resource limits as well.
For Kubernetes or containerd, use the integration guide for that environment rather than copying Docker’s daemon setup. A practical rollout starts with a test node or workload class, checks application behavior and observability, and measures representative CPU, memory, filesystem, and network workloads before wider adoption.
Common Misconceptions
“gVisor is a virtual machine.” It does not boot a separate guest Linux kernel. Its application kernel runs in userspace, so it provides a different boundary from a microVM.
“An OCI runtime is automatically secure.” OCI standardizes how a runtime is asked to create and manage containers. Security properties depend on what the runtime implements and how operators configure it.
“gVisor makes container configuration irrelevant.” A sandbox does not make a privileged container, an exposed host path, a mounted credential, or an unrestricted network policy safe. Reduce granted capabilities and scope the workload’s resources.
“Every Linux application will work unchanged.” gVisor implements a Linux-like interface, not every kernel behavior or device. Test the actual workload, especially software with unusual system-call, filesystem, or networking requirements.
“The host kernel is no longer part of the trusted base.” The host still runs gVisor and provides resources. Updates, least privilege, secure host operation, and a clear threat model remain necessary.
Related Articles
- Linux namespaces and container isolation
- Containerization versus virtualization
- Firecracker microVM architecture
- Docker containers for beginners
Changelog
- Initial publication.
Last updated: October 18.

