about summary refs log tree commit diff
path: root/nixpkgs/doc/functions
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-09-11 15:24:55 +0000
committerAlyssa Ross <hi@alyssa.is>2019-09-16 22:14:45 +0000
commit89c4dccbd5f33f71808d4b1baafe619696af1162 (patch)
treefb1b8d3a2f171164a05d404ab2340cfb1a9d3e21 /nixpkgs/doc/functions
parent8920a0e4d962a919238bab69ddc607d7f3396f70 (diff)
parente19054ab3cd5b7cc9a01d0efc71c8fe310541065 (diff)
downloadnixlib-89c4dccbd5f33f71808d4b1baafe619696af1162.tar
nixlib-89c4dccbd5f33f71808d4b1baafe619696af1162.tar.gz
nixlib-89c4dccbd5f33f71808d4b1baafe619696af1162.tar.bz2
nixlib-89c4dccbd5f33f71808d4b1baafe619696af1162.tar.lz
nixlib-89c4dccbd5f33f71808d4b1baafe619696af1162.tar.xz
nixlib-89c4dccbd5f33f71808d4b1baafe619696af1162.tar.zst
nixlib-89c4dccbd5f33f71808d4b1baafe619696af1162.zip
Merge commit 'e19054ab3cd5b7cc9a01d0efc71c8fe310541065'
Diffstat (limited to 'nixpkgs/doc/functions')
-rw-r--r--nixpkgs/doc/functions/ocitools.xml76
1 files changed, 76 insertions, 0 deletions
diff --git a/nixpkgs/doc/functions/ocitools.xml b/nixpkgs/doc/functions/ocitools.xml
new file mode 100644
index 000000000000..4500c41a34ae
--- /dev/null
+++ b/nixpkgs/doc/functions/ocitools.xml
@@ -0,0 +1,76 @@
+<section xmlns="http://docbook.org/ns/docbook"
+         xmlns:xlink="http://www.w3.org/1999/xlink"
+         xmlns:xi="http://www.w3.org/2001/XInclude"
+         xml:id="sec-pkgs-ociTools">
+ <title>pkgs.ociTools</title>
+
+ <para>
+  <varname>pkgs.ociTools</varname> is a set of functions for creating
+  containers according to the
+  <link xlink:href="https://github.com/opencontainers/runtime-spec">OCI
+  container specification v1.0.0</link>. Beyond that it makes no assumptions
+  about the container runner you choose to use to run the created container.
+ </para>
+
+ <section xml:id="ssec-pkgs-ociTools-buildContainer">
+  <title>buildContainer</title>
+
+  <para>
+   This function creates a simple OCI container that runs a single command
+   inside of it. An OCI container consists of a <varname>config.json</varname>
+   and a rootfs directory.The nix store of the container will contain all
+   referenced dependencies of the given command.
+  </para>
+
+  <para>
+   The parameters of <varname>buildContainer</varname> with an example value
+   are described below:
+  </para>
+
+  <example xml:id='ex-ociTools-buildContainer'>
+   <title>Build Container</title>
+<programlisting>
+buildContainer {
+  cmd = with pkgs; writeScript "run.sh" ''
+    #!${bash}/bin/bash
+    ${coreutils}/bin/exec ${bash}/bin/bash
+  ''; <co xml:id='ex-ociTools-buildContainer-1' />
+
+  mounts = {
+    "/data" = {
+      type = "none";
+      source = "/var/lib/mydata";
+      options = [ "bind" ];
+    };
+  };<co xml:id='ex-ociTools-buildContainer-2' />
+
+  readonly = false; <co xml:id='ex-ociTools-buildContainer-3' />
+}
+
+    </programlisting>
+   <calloutlist>
+    <callout arearefs='ex-ociTools-buildContainer-1'>
+     <para>
+      <varname>cmd</varname> specifies the program to run inside the container.
+      This is the only required argument for <varname>buildContainer</varname>.
+      All referenced packages inside the derivation will be made available
+      inside the container
+     </para>
+    </callout>
+    <callout arearefs='ex-ociTools-buildContainer-2'>
+     <para>
+      <varname>mounts</varname> specifies additional mount points chosen by the
+      user. By default only a minimal set of necessary filesystems are mounted
+      into the container (e.g procfs, cgroupfs)
+     </para>
+    </callout>
+    <callout arearefs='ex-ociTools-buildContainer-3'>
+     <para>
+       <varname>readonly</varname> makes the container's rootfs read-only if it is set to true.
+       The default value is false <literal>false</literal>.
+     </para>
+    </callout>
+   </calloutlist>
+  </example>
+ </section>
+</section>