"Missing manifest" error at $ rkt run

84 Views Asked by At

I have the following shell script which creates a Debian base aci container for rkt / appC:

#!/bin/sh
set -e

# $ zcat debian.aci | tree | head
# $ rkt run debian.aci --insecure-options=image

export MY_CHROOT=/var/lib/container/aci/debian

mkdir -p $MY_CHROOT

debootstrap --verbose --arch=amd64 --include=iputils-ping,iproute --variant=minbase stable $MY_CHROOT/rootfs http://httpredir.debian.org/debian

cat > $MY_CHROOT/manifest <<EOF
{
  "acKind": "ImageManifest",
  "acVersion": "0.8.9",
  "name": "debian",
  "labels": [
    {"name": "arch", "value": "amd64"},
    {"name": "os", "value": "linux"},
    {"name": "version", "value": "1.0.0"}
  ],
  "app": {
    "exec": [
      "/bin/sh",
      "echo",
      "Hello, World from $MY_ENV_VAR!"
    ],
    "user": "0",
    "group": "0",
    "environment": [
      {
        "name": "MY_ENV_VAR",
        "value": "$(whoami)"
      }
    ],
  },
  "annotations": {
    "authors": "Istvan Lantos <[email protected]>"
  }
}
EOF

# use gpg to create a sig, but we'll skip that for now
tar cvvf - $MY_CHROOT/manifest $MY_CHROOT/rootfs | gzip -c > $MY_CHROOT/debian.aci

To verify that manifest file is present:

root@debian:/var/lib/container/aci/debian# zcat debian.aci | tree | head
.
├── debian.aci
├── manifest
└── rootfs
    ├── bin
    │   ├── bash
    │   ├── cat
    │   ├── chacl
    │   ├── chgrp
    │   ├── chmod

When I try to run this container with $ rkt run debian.aci --insecure-options=image command, I got the following error:

run: missing manifest

I followed these guides for file structure:

https://github.com/appc/spec

https://github.com/appc/spec/blob/master/spec/aci.md#image-layout

https://github.com/appc/spec/blob/master/examples/image.json

Why not working?

Thank You for your help!

1

There are 1 best solutions below

0
Lanti On

Actually, the error is caused by tar which includes absolute paths in the archive.

So solution is to cd in the directory and not use absolute paths prefixed by $MY_CHROOT.

Source: https://unix.stackexchange.com/a/59246/120771