summaryrefslogtreecommitdiffhomepage
path: root/content/docs/user_guide/oci.md
blob: 49b94bdd3159c509fe56170e4ec8fbbdfb5a30ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
+++
title = "OCI Quick Start"
weight = 20
+++
This guide will quickly get you started running your first gVisor sandbox
container using the runtime directly with the default platform.

## Install gVisor

{{% readfile file="docs/includes/install_gvisor.md" markdown="true" %}}

## Run an OCI compatible container

Now we will create an [OCI][oci] container bundle to run our container. First we
will create a root directory for our bundle.

```bash
{
  mkdir bundle
  cd bundle
}
```

Create a root file system for the container. We will use the Docker hello-world
image as the basis for our container.

```bash
{
  mkdir rootfs
  docker export $(docker create hello-world) | tar -xf - -C rootfs
}
```

Next, create an specification file called `config.json` that contains our
container specification. We will update the default command it runs to `/hello`
in the `hello-world` container.

```bash
{
  runsc spec
  sed -i 's;"sh";"/hello";' config.json
}
```

Finally run the container.

```bash
sudo runsc run hello
```

Next try [running gVisor using Docker](../docker/).

[oci]: https://opencontainers.org/