···11+<section xmlns="http://docbook.org/ns/docbook"
22+ xmlns:xlink="http://www.w3.org/1999/xlink"
33+ xmlns:xi="http://www.w3.org/2001/XInclude"
44+ xml:id="sec-pkgs-ociTools">
55+ <title>pkgs.ociTools</title>
66+77+ <para>
88+ <varname>pkgs.ociTools</varname> is a set of functions for creating
99+ containers according to the
1010+ <link xlink:href="https://github.com/opencontainers/runtime-spec">OCI
1111+ container specification v1.0.0</link>. Beyond that it makes no assumptions
1212+ about the container runner you choose to use to run the created container.
1313+ </para>
1414+1515+ <section xml:id="ssec-pkgs-ociTools-buildContainer">
1616+ <title>buildContainer</title>
1717+1818+ <para>
1919+ This function creates a simple OCI container that runs a single command
2020+ inside of it. An OCI container consists of a <varname>config.json</varname>
2121+ and a rootfs directory.The nix store of the container will contain all
2222+ referenced dependencies of the given command.
2323+ </para>
2424+2525+ <para>
2626+ The parameters of <varname>buildContainer</varname> with an example value
2727+ are described below:
2828+ </para>
2929+3030+ <example xml:id='ex-ociTools-buildContainer'>
3131+ <title>Build Container</title>
3232+<programlisting>
3333+buildContainer {
3434+ cmd = with pkgs; writeScript "run.sh" ''
3535+ #!${bash}/bin/bash
3636+ ${coreutils}/bin/exec ${bash}/bin/bash
3737+ ''; <co xml:id='ex-ociTools-buildContainer-1' />
3838+3939+ mounts = {
4040+ "/data" = {
4141+ type = "none";
4242+ source = "/var/lib/mydata";
4343+ options = [ "bind" ];
4444+ };
4545+ };<co xml:id='ex-ociTools-buildContainer-2' />
4646+4747+ readonly = false; <co xml:id='ex-ociTools-buildContainer-3' />
4848+}
4949+5050+ </programlisting>
5151+ <calloutlist>
5252+ <callout arearefs='ex-ociTools-buildContainer-1'>
5353+ <para>
5454+ <varname>cmd</varname> specifies the program to run inside the container.
5555+ This is the only required argument for <varname>buildContainer</varname>.
5656+ All referenced packages inside the derivation will be made available
5757+ inside the container
5858+ </para>
5959+ </callout>
6060+ <callout arearefs='ex-ociTools-buildContainer-2'>
6161+ <para>
6262+ <varname>mounts</varname> specifies additional mount points chosen by the
6363+ user. By default only a minimal set of necessary filesystems are mounted
6464+ into the container (e.g procfs, cgroupfs)
6565+ </para>
6666+ </callout>
6767+ <callout arearefs='ex-ociTools-buildContainer-3'>
6868+ <para>
6969+ <varname>readonly</varname> makes the container's rootfs read-only if it is set to true.
7070+ The default value is false <literal>false</literal>.
7171+ </para>
7272+ </callout>
7373+ </calloutlist>
7474+ </example>
7575+ </section>
7676+</section>