init: replace ctr with a custom client using the containerd client library

Currently it supports only `service start <SERVICE>`, but it could grow e.g.
`stop`, `exec` etc in the future (although you can still use `ctr` for those).

In order to be able to use go-compile.sh the containerd build needs to move
from /root/go to /go as the GOPATH.

The vendoring situation is not ideal, but since this tool wants to be an exact
match for the containerd it seems tollerable to reuse its vendoring.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
This commit is contained in:
Ian Campbell
2017-06-13 16:27:54 +01:00
parent f7b2a739ee
commit 5833d1b6bc
50 changed files with 293 additions and 89 deletions

View File

@@ -34,12 +34,9 @@ if [ -d /containers/services ]
then
for f in $(find /containers/services -mindepth 1 -maxdepth 1 | sort)
do
base="$(basename $f)"
/bin/mount --bind "$f/rootfs" "$f/rootfs"
mount -o remount,rw "$f/rootfs"
log="/var/log/$base.log"
ctr run --runtime-config "$f/config.json" --rootfs "$f/rootfs" --id "$(basename $f)" </dev/null 2>$log >$log &
printf " - $base\n"
service start "$(basename $f)"
done
fi