Home Explore Blog CI



docker

1st chunk of `content/manuals/engine/daemon/alternative-runtimes.md`
93f4cabb93a30ac3a1ea195be65f13c9a4d02e6917b101f30000000100000d83
---
title: Alternative container runtimes
description: |
  Docker Engine uses runc as the default container runtime, but you
  can specify alternative runtimes using the CLI or by configuring
  the daemon
keywords: engine, runtime, containerd, runtime v2, shim
aliases:
  - /engine/alternative-runtimes/
---

Docker Engine uses containerd for managing the container lifecycle,
which includes creating, starting, and stopping containers.
By default, containerd uses runc as its container runtime.

## What runtimes can I use?

You can use any runtime that implements the containerd 
[shim API](https://github.com/containerd/containerd/blob/main/core/runtime/v2/README.md).
Such runtimes ship with a containerd shim, and you can use them without any
additional configuration. See [Use containerd shims](#use-containerd-shims).

Examples of runtimes that implement their own containerd shims include:

- [Wasmtime](https://wasmtime.dev/)
- [gVisor](https://github.com/google/gvisor)
- [Kata Containers](https://katacontainers.io/)

You can also use runtimes designed as drop-in replacements for runc. Such
runtimes depend on the runc containerd shim for invoking the runtime binary.
You must manually register such runtimes in the daemon configuration.

[youki](https://github.com/youki-dev/youki)
is one example of a runtime that can function as a runc drop-in replacement.
Refer to the [youki example](#youki) explaining the setup.

## Use containerd shims

containerd shims let you use alternative runtimes without having to change the
configuration of the Docker daemon. To use a containerd shim, install the shim
binary on `PATH` on the system where the Docker daemon is running.

To use a shim with `docker run`, specify the fully qualified name of the
runtime as the value to the `--runtime` flag:

```console
$ docker run --runtime io.containerd.kata.v2 hello-world
```

### Use a containerd shim without installing on PATH

You can use a shim without installing it on `PATH`, in which case you need to
register the shim in the daemon configuration as follows:

```json
{
  "runtimes": {
    "foo": {
      "runtimeType": "/path/to/containerd-shim-foobar-v1"
    }
  }
}
```

To use the shim, specify the name that you assigned to it:

```console
$ docker run --runtime foo hello-world
```

### Configure shims

If you need to pass additional configuration for a containerd shim, you can
use the `runtimes` option in the daemon configuration file.

1. Edit the daemon configuration file by adding a `runtimes` entry for the
   shim you want to configure.

   - Specify the fully qualified name for the runtime in `runtimeType` key
   - Add your runtime configuration under the `options` key

   ```json
   {
     "runtimes": {
       "gvisor": {
         "runtimeType": "io.containerd.runsc.v1",
         "options": {
           "TypeUrl": "io.containerd.runsc.v1.options",
           "ConfigPath": "/etc/containerd/runsc.toml"
         }
       }
     }
   }
   ```

2. Reload the daemon's configuration.

   ```console
   # systemctl reload docker
   ```

3. Use the customized runtime using the `--runtime` flag for `docker run`.

   ```console
   $ docker run --runtime gvisor hello-world
   ```

For more information about the configuration options for containerd shims, see
[Configure containerd shims](/reference/cli/dockerd.md#configure-containerd-shims).

## Examples

The following examples show you how to set up and use alternative container

Title: Using Alternative Container Runtimes with Docker
Summary
Docker Engine uses containerd to manage container lifecycles, with runc as the default runtime. Alternative runtimes implementing the containerd shim API, such as Wasmtime, gVisor, and Kata Containers, can be used without additional configuration by installing the shim binary on the system's PATH. Runtimes designed as drop-in replacements for runc, like youki, require manual registration in the daemon configuration. Shims can be used without PATH installation by registering them in the daemon configuration. Additional configurations for shims can be passed through the `runtimes` option in the daemon configuration file, allowing customization of runtime behavior. The document provides examples of setting up and using alternative container runtimes.