Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,11 @@ ocitools is a collection of tools for working with the [OCI runtime specificatio
[`ocitools generate`][generate.1] generates [configuration JSON][config.json] for an [OCI bundle][bundle].
[OCI-compatible runtimes][runtime-spec] like [runC][] expect to read the configuration from `config.json`.

```sh
$ ocitools generate --output config.json
$ cat config.json
{
"ociVersion": "0.5.0",
}
```

## Validating an OCI bundle

[`ocitools validate`][validate.1] validates an OCI bundle.
The error message will be printed if the OCI bundle failed the validation procedure.

```sh
$ ocitools generate
$ ocitools validate
INFO[0000] Bundle validation succeeded.
```

## Testing OCI runtimes
Copy link
Member

@runcom runcom Jul 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this example is here? shouldn't it go the man page as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the question is: shouldn't testruntime.sh be a part of ocitools?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Fri, Jul 22, 2016 at 09:43:41AM -0700, Antonio Murdaca wrote:

Testing OCI runtimes

I guess the question is: shouldn't testruntime.sh be a part of ocitools?

Yes, but it's hard to do right ;). See discussion in #61 and #98 (I'm
partial to 1 ;).


Expand Down
18 changes: 14 additions & 4 deletions man/ocitools-generate.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,16 @@ inside of the container.

# EXAMPLES

## Generate a default configuration

With choices that the ocitools developers think are sane.

$ ocitools generate
{
"ociVersion": "0.5.0",
}

## Generating container in read-only mode

During container image development, containers often need to write to the image
Expand All @@ -237,14 +247,14 @@ This protects the containers image from modification. Read only containers may
still need to write temporary data. The best way to handle this is to mount
tmpfs directories on /generate and /tmp.

# ocitools generate --read-only --tmpfs /generate --tmpfs /tmp --tmpfs /run --rootfs /var/lib/containers/fedora /bin/bash
$ ocitools generate --read-only --tmpfs /generate --tmpfs /tmp --tmpfs /run --rootfs /var/lib/containers/fedora /bin/bash

## Exposing log messages from the container to the host's log

If you want messages that are logged in your container to show up in the host's
syslog/journal then you should bind mount the /dev/log directory as follows.

# ocitools generate --bind /dev/log:/dev/log --rootfs /var/lib/containers/fedora /bin/bash
$ ocitools generate --bind /dev/log:/dev/log --rootfs /var/lib/containers/fedora /bin/bash

From inside the container you can test this by sending a message to the log.

Expand All @@ -264,13 +274,13 @@ To mount a host directory as a container volume, specify the absolute path to
the directory and the absolute path for the container directory separated by a
colon:

# ocitools generate --bind /var/db:/data1 --rootfs /var/lib/containers/fedora --args bash
$ ocitools generate --bind /var/db:/data1 --rootfs /var/lib/containers/fedora --args bash

## Using SELinux

You can use SELinux to add security to the container. You must specify the process label to run the init process inside of the container using the --selinux-label.

# ocitools generate --bind /var/db:/data1 --selinux-label system_u:system_r:svirt_lxc_net_t:s0:c1,c2 --mount-label system_u:object_r:svirt_sandbox_file_t:s0:c1,c2 --rootfs /var/lib/containers/fedora --args bash
$ ocitools generate --bind /var/db:/data1 --selinux-label system_u:system_r:svirt_lxc_net_t:s0:c1,c2 --mount-label system_u:object_r:svirt_sandbox_file_t:s0:c1,c2 --rootfs /var/lib/containers/fedora --args bash

Not in the above example we used a type of svirt_lxc_net_t and an MCS Label of s0:c1,c2. If you want to guarantee separation between containers, you need to make sure that each container gets launched with a different MCS Label pair.

Expand Down
17 changes: 17 additions & 0 deletions man/ocitools-validate.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@ Validate an OCI bundle
launching this container"), but will fail with it ("this host is not capable
of launching this container").

# EXAMPLES

Generate a basic configuration:

$ ocitools generate --output config.json
$ mkdir rootfs

Validate it for specification compliance:

$ ocitools validate
Bundle validation succeeded.

Check whether it will run on your current host:

$ ocitools validate --host-specific
Bundle validation succeeded.

# SEE ALSO
**ocitools**(1)

Expand Down