2020-04-28 05:24:58 +00:00
|
|
|
# OCI
|
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.
|
|
|
|
|
2019-11-18 21:40:27 +00:00
|
|
|
First, follow the [Installation guide][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
|
2019-04-03 18:09:07 +00:00
|
|
|
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
|
2019-04-03 18:09:07 +00:00
|
|
|
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
|
2019-04-03 18:09:07 +00:00
|
|
|
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
|
|
|
|
```
|
|
|
|
|
2020-05-12 19:55:23 +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
|