charliecloud icon indicating copy to clipboard operation
charliecloud copied to clipboard

ch-run: run oci bundles

Open kchilleri opened this issue 11 months ago • 6 comments

If option --oci or --o is provided/enabled and the image path is the path to an OCI bundle containing a directory named rootfs and a spec file config.json then parse the JSON file and distribute the arguments to the corresponding Charliecloud container arguments.

Example:

kchilleri@dev:/usr/local/src/charliecloud$ ls ~/examples/redis
config.json  rootfs
kchilleri@dev:/usr/local/src/charliecloud$ ls ~/examples/redis/rootfs/
bin  boot  data  dev  etc  home  lib  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
kchilleri@dev:/usr/local/src/charliecloud$ cat ~/examples/redis/config.json 
{
        "ociVersion": "1.0.2-dev",
        "process": {
                "terminal": true,
                "user": {}, 

                "args": [
                        "sh", "redis-server", "--bind", "0.0.0.0"
                ],
                "env": [
                        "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                        "TERM=xterm"
                ],
                "cwd": "/",
                "capabilities": {
                        "bounding": [
                                "CAP_AUDIT_WRITE",
                                "CAP_KILL",
                                "CAP_NET_BIND_SERVICE"
                        ],
...
kchilleri@dev:/usr/local/src/charliecloud$ ch-run --oci ~/examples/redis -- true

closes #1754

kchilleri avatar Mar 21 '24 18:03 kchilleri

e.g. this one is BSD licensed and recommends “just drop json.c and json.h into your project”.

reidpr avatar Mar 25 '24 19:03 reidpr

this one similarly

reidpr avatar Mar 25 '24 19:03 reidpr

FWIW, we should embrace JSON parsing sooner, rather than later. I suspect it would be very useful for things like oci-hooks for GPU injection.

j-ogas avatar Mar 26 '24 21:03 j-ogas

@j-ogas do you have an opinion on whether it lives in ch-run or a Python wrapper?

reidpr avatar Mar 27 '24 16:03 reidpr

@j-ogas do you have an opinion on whether it lives in ch-run or a Python wrapper?

Python may offer the path of the least resistance. Aside from that, not really.

j-ogas avatar Apr 01 '24 21:04 j-ogas

TO DO:

  1. Add documentation
  2. Perhaps more error checking

kchilleri avatar Jun 10 '24 19:06 kchilleri