Convert Figma logo to code with AI

google logogvisor

Application Kernel for Containers

15,712
1,289
15,712
436

Top Related Projects

7,892

contaiNERD CTL - Docker-compatible CLI for containerd, with support for Compose, Rootless, eStargz, OCIcrypt, IPFS, ...

Kata Containers is an open source project and community working to build a standard implementation of lightweight Virtual Machines (VMs) that feel and perform like containers, but provide the workload isolation and security advantages of VMs. https://katacontainers.io/

Secure and fast microVMs for serverless computing.

3,486

Ignite a Firecracker microVM

2,763

An open-source, next-generation "runc" that empowers rootless containers to run workloads such as Systemd, Docker, Kubernetes, just like VMs.

11,728

CLI tool for spawning and running containers according to the OCI specification

Quick Overview

gVisor is an application kernel for containers that provides secure isolation and virtualization. It implements a substantial portion of the Linux system call interface in userspace, offering a lightweight alternative to traditional virtual machines while maintaining strong security boundaries.

Pros

  • Enhanced security through sandboxing and reduced attack surface
  • Improved isolation between containers and the host system
  • Compatibility with existing container ecosystems (e.g., Docker, Kubernetes)
  • Lower overhead compared to full virtual machines

Cons

  • Performance overhead compared to native containers
  • Not all system calls are fully implemented, leading to potential compatibility issues
  • Steeper learning curve for configuration and troubleshooting
  • Limited hardware support compared to traditional virtualization

Getting Started

To get started with gVisor, follow these steps:

  1. Install gVisor:

    wget https://storage.googleapis.com/gvisor/releases/release/latest/runsc
    chmod +x runsc
    sudo mv runsc /usr/local/bin
    
  2. Configure Docker to use gVisor:

    sudo mkdir -p /etc/docker
    echo '{
      "runtimes": {
        "runsc": {
          "path": "/usr/local/bin/runsc"
        }
      }
    }' | sudo tee /etc/docker/daemon.json
    sudo systemctl restart docker
    
  3. Run a container with gVisor:

    docker run --runtime=runsc -it ubuntu /bin/bash
    

For more detailed instructions and advanced configurations, refer to the official gVisor documentation.

Competitor Comparisons

7,892

contaiNERD CTL - Docker-compatible CLI for containerd, with support for Compose, Rootless, eStargz, OCIcrypt, IPFS, ...

Pros of nerdctl

  • Lightweight and easy to use CLI for containerd
  • Supports OCI image format and Docker-compatible commands
  • Integrates well with existing container ecosystems

Cons of nerdctl

  • Less comprehensive security isolation compared to gVisor
  • May not provide the same level of performance optimization for specific workloads

Code Comparison

nerdctl:

nerdctl run -d --name nginx nginx:latest
nerdctl exec nginx ls /
nerdctl stop nginx

gVisor:

runsc run -bundle /path/to/bundle mycontainer
runsc exec mycontainer ls /
runsc kill mycontainer

Key Differences

  • nerdctl focuses on providing a user-friendly interface for containerd, while gVisor emphasizes enhanced security through application kernel isolation
  • gVisor offers stronger isolation between containers and the host system, but may introduce some performance overhead
  • nerdctl provides a more familiar Docker-like experience, making it easier for users transitioning from Docker

Use Cases

  • nerdctl: General-purpose container management, CI/CD pipelines, and development environments
  • gVisor: Security-sensitive applications, multi-tenant environments, and scenarios requiring stricter isolation between containers

Community and Ecosystem

  • nerdctl benefits from the wider containerd ecosystem and compatibility with Docker tools
  • gVisor has a more specialized focus but offers unique security features for specific use cases

Kata Containers is an open source project and community working to build a standard implementation of lightweight Virtual Machines (VMs) that feel and perform like containers, but provide the workload isolation and security advantages of VMs. https://katacontainers.io/

Pros of kata-containers

  • Provides stronger isolation by using lightweight VMs, offering better security for multi-tenant environments
  • Supports multiple architectures and hypervisors, allowing for greater flexibility in deployment
  • Offers better compatibility with existing container ecosystems and tools

Cons of kata-containers

  • Generally has higher resource overhead compared to gVisor due to the use of lightweight VMs
  • May have slightly slower startup times than gVisor in some scenarios
  • Requires hardware virtualization support, which may not be available in all environments

Code comparison

While both projects focus on container runtime security, they have different implementation approaches. Here's a simplified example of how they might be used:

gVisor:

docker run --runtime=runsc my-container

kata-containers:

docker run --runtime=kata-runtime my-container

Both gVisor and kata-containers aim to enhance container security, but they use different methods to achieve this goal. gVisor provides a user-space kernel written in Go, while kata-containers uses lightweight VMs. The choice between them depends on specific use cases, security requirements, and available resources.

Secure and fast microVMs for serverless computing.

Pros of Firecracker

  • Lightweight and fast: Optimized for serverless and container workloads
  • Strong isolation: Uses KVM for enhanced security
  • Low memory footprint: Efficient resource utilization

Cons of Firecracker

  • Limited guest OS support: Primarily focuses on Linux
  • Less flexibility: Designed for specific use cases, may not suit all scenarios

Code Comparison

Firecracker (Rust):

let mut vmm = Builder::new()
    .with_boot_source(boot_source)
    .with_network_interfaces(net_ifaces)
    .build()
    .unwrap();

vmm.start().unwrap();

gVisor (Go):

conf := &boot.Config{
    RootDir: rootDir,
    Network: boot.NetworkNone,
}
cont, err := boot.New(conf)
if err != nil {
    log.Fatalf("error creating container: %v", err)
}

Key Differences

  • Language: Firecracker is written in Rust, while gVisor is in Go
  • Virtualization approach: Firecracker uses KVM, gVisor uses user-space kernel
  • Use cases: Firecracker targets serverless, gVisor focuses on container security
  • Performance: Firecracker generally offers better performance for its use case
  • Compatibility: gVisor provides broader Linux syscall compatibility

Both projects aim to improve container security and isolation, but take different approaches to achieve this goal.

3,486

Ignite a Firecracker microVM

Pros of Ignite

  • Lightweight and fast VM management using Firecracker
  • Integrates well with Kubernetes and container workflows
  • Supports multiple operating systems and architectures

Cons of Ignite

  • Less mature and battle-tested compared to gVisor
  • Smaller community and ecosystem
  • Limited to Firecracker-based VMs, less flexible for other use cases

Code Comparison

Ignite (Go):

import (
    "github.com/weaveworks/ignite/pkg/apis/ignite"
    "github.com/weaveworks/ignite/pkg/apis/ignite/scheme"
)

vm := &ignite.VM{
    Spec: ignite.VMSpec{
        Image: ignite.ImageSpec{Name: "weaveworks/ignite-ubuntu"},
        CPUs:  2,
        Memory: ignite.Size{MB: 1024},
    },
}

gVisor (Go):

import (
    "gvisor.dev/gvisor/pkg/sentry/kernel"
    "gvisor.dev/gvisor/pkg/sentry/kernel/auth"
)

k := &kernel.Kernel{
    Platform:   p,
    Timekeeper: tk,
    RootUserNamespace: auth.NewRootUserNamespace(),
}

Both projects aim to improve container isolation and security, but they take different approaches. Ignite focuses on lightweight VMs using Firecracker, while gVisor provides a user-space kernel for enhanced container isolation. The code snippets show how each project is used to create and configure their respective environments.

2,763

An open-source, next-generation "runc" that empowers rootless containers to run workloads such as Systemd, Docker, Kubernetes, just like VMs.

Pros of Sysbox

  • Provides stronger container isolation without performance overhead
  • Supports running Docker and Kubernetes inside containers
  • Allows running systemd-based containers without modifications

Cons of Sysbox

  • Less mature project with smaller community compared to gVisor
  • Limited to Linux hosts, while gVisor supports multiple platforms
  • May require more setup and configuration than gVisor

Code Comparison

Sysbox (system container creation):

docker run --runtime=sysbox-runc -it --rm nestybox/ubuntu-bionic-systemd

gVisor (sandboxed container creation):

docker run --runtime=runsc -it --rm ubuntu

Key Differences

  • Sysbox focuses on system containers, while gVisor emphasizes application containers
  • Sysbox modifies the container runtime, whereas gVisor acts as a kernel proxy
  • Sysbox aims for full Linux compatibility, while gVisor implements a limited set of system calls

Use Cases

  • Sysbox: Ideal for running complex applications or nested containers
  • gVisor: Better suited for running untrusted or potentially malicious code

Community and Support

  • gVisor has a larger community and more frequent updates
  • Sysbox offers commercial support through Nestybox
11,728

CLI tool for spawning and running containers according to the OCI specification

Pros of runc

  • Lightweight and efficient, with minimal overhead
  • Widely adopted and supported in the container ecosystem
  • Direct access to host system resources for better performance

Cons of runc

  • Less isolation between containers and the host system
  • Potentially higher security risks due to shared kernel space

Code Comparison

runc:

func (r *Runc) Create(context context.Context, id, bundle string, opts *CreateOpts) error {
    args := []string{"create", "--bundle", bundle}
    if opts != nil {
        args = append(args, opts.AdditionalArgs...)
    }
    cmd := r.command(context, append(args, id)...)
    return runOrError(cmd)
}

gVisor:

func (r *Runtime) Create(id string, spec *specs.Spec, conf *boot.Config, bundleDir string, consoleSocket string, ioFiles []*os.File) error {
    args := []string{"create", "-bundle", bundleDir}
    if consoleSocket != "" {
        args = append(args, "-console-socket", consoleSocket)
    }
    cmd := r.command(append(args, id)...)
    return runOrError(cmd)
}

Both repositories provide container runtime implementations, but gVisor focuses on enhanced security through user-space kernel emulation, while runc offers a more traditional containerization approach. gVisor trades some performance for increased isolation, making it suitable for multi-tenant environments or running untrusted code. runc, being more lightweight, is often preferred for general-purpose containerization needs where performance is a priority.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

gVisor

Build status Issue reviver CodeQL gVisor chat code search

What is gVisor?

gVisor provides a strong layer of isolation between running applications and the host operating system. It is an application kernel that implements a Linux-like interface. Unlike Linux, it is written in a memory-safe language (Go) and runs in userspace.

gVisor includes an Open Container Initiative (OCI) runtime called runsc that makes it easy to work with existing container tooling. The runsc runtime integrates with Docker and Kubernetes, making it simple to run sandboxed containers.

What isn't gVisor?

  • gVisor is not a syscall filter (e.g. seccomp-bpf), nor a wrapper over Linux isolation primitives (e.g. firejail, AppArmor, etc.).
  • gVisor is also not a VM in the everyday sense of the term (e.g. VirtualBox, QEMU).

gVisor takes a distinct third approach, providing many security benefits of VMs while maintaining the lower resource footprint, fast startup, and flexibility of regular userspace applications.

Why does gVisor exist?

Containers are not a sandbox. While containers have revolutionized how we develop, package, and deploy applications, using them to run untrusted or potentially malicious code without additional isolation is not a good idea. While using a single, shared kernel allows for efficiency and performance gains, it also means that container escape is possible with a single vulnerability.

gVisor is an application kernel for containers. It limits the host kernel surface accessible to the application while still giving the application access to all the features it expects. Unlike most kernels, gVisor does not assume or require a fixed set of physical resources; instead, it leverages existing host kernel functionality and runs as a normal process. In other words, gVisor implements Linux by way of Linux.

gVisor should not be confused with technologies and tools to harden containers against external threats, provide additional integrity checks, or limit the scope of access for a service. One should always be careful about what data is made available to a container.

Documentation

User documentation and technical architecture, including quick start guides, can be found at gvisor.dev.

Installing from source

gVisor builds on x86_64 and ARM64. Other architectures may become available in the future.

For the purposes of these instructions, bazel and other build dependencies are wrapped in a build container. It is possible to use bazel directly, or type make help for standard targets.

Requirements

Make sure the following dependencies are installed:

Building

Build and install the runsc binary:

mkdir -p bin
make copy TARGETS=runsc DESTINATION=bin/
sudo cp ./bin/runsc /usr/local/bin

Testing

To run standard test suites, you can use:

make unit-tests
make tests

To run specific tests, you can specify the target:

make test TARGETS="//runsc:version_test"

Using go get

This project uses bazel to build and manage dependencies. A synthetic go branch is maintained that is compatible with standard go tooling for convenience.

For example, to build and install runsc directly from this branch:

echo "module runsc" > go.mod
GO111MODULE=on go get gvisor.dev/gvisor/runsc@go
CGO_ENABLED=0 GO111MODULE=on sudo -E go build -o /usr/local/bin/runsc gvisor.dev/gvisor/runsc

Subsequently, you can build and install the shim binary for containerd:

GO111MODULE=on sudo -E go build -o /usr/local/bin/containerd-shim-runsc-v1 gvisor.dev/gvisor/shim

Note that this branch is supported in a best effort capacity, and direct development on this branch is not supported. Development should occur on the master branch, which is then reflected into the go branch.

Community & Governance

See GOVERNANCE.md for project governance information.

The gvisor-users mailing list and gvisor-dev mailing list are good starting points for questions and discussion.

Security Policy

See SECURITY.md.

Contributing

See Contributing.md.