gvisor/content/docs/user_guide/quick_start/oci.md

51 lines
1.1 KiB
Markdown
Raw Normal View History

2019-03-30 02:40:11 +00:00
+++
2019-09-12 07:26:09 +00:00
title = "OCI"
2019-04-03 16:08:27 +00:00
weight = 30
2019-03-30 02:40:11 +00:00
+++
2019-09-12 07:26:09 +00:00
2019-03-30 02:40:11 +00:00
This guide will quickly get you started running your first gVisor sandbox
container using the runtime directly with the default platform.
## Install gVisor
2019-09-12 07:26:09 +00:00
First, install gVisor using the [install instructions][install].
2019-03-30 02:40:11 +00:00
## 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
2019-03-30 02:40:11 +00:00
```
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
2019-03-30 02:40:11 +00:00
```
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
2019-03-30 02:40:11 +00:00
```
Finally run the container.
```bash
sudo runsc run hello
```
2019-12-21 07:59:04 +00:00
Next try [using CNI to set up networking](../../../tutorials/cni/) or [running gVisor using Docker](../docker/).
2019-03-30 02:40:11 +00:00
[oci]: https://opencontainers.org/
2019-09-12 07:26:09 +00:00
[install]: /docs/user_guide/install