Move onboot startup script to runc package

As this does not use containerd at all, this means you can run very
minimal setups with just `runc` if you use no services, for example
most of our tests do not actually use services, or if you have other
similar very minimal use cases.

Move ulimit setup to `init` which makes more sense.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2017-07-12 16:31:59 +01:00
parent 22be0a10bf
commit 28b4245b12
6 changed files with 22 additions and 19 deletions

View File

@ -1,5 +1,5 @@
IMAGE=containerd
NETWORK=1
DEPS=$(wildcard etc/init.d/*)
DEPS=$(wildcard etc/init.d/*) etc/containerd/config.toml
include ../package.mk

View File

@ -1,9 +1,5 @@
#!/bin/sh
# set global ulimits TODO move to /etc/limits.conf
ulimit -n 1048576
ulimit -p unlimited
# bring up containerd
printf "\nStarting containerd\n"
/usr/bin/containerd &
@ -14,20 +10,6 @@ do
sleep 0.1
done
# start onboot containers, run to completion
if [ -d /containers/onboot ]
then
for f in $(find /containers/onboot -mindepth 1 -maxdepth 1 | sort)
do
base="$(basename $f)"
/bin/mount --bind "$f/rootfs" "$f/rootfs"
mount -o remount,rw "$f/rootfs"
/usr/bin/runc run --bundle "$f" "$(basename $f)"
printf " - $base\n"
done
fi
# start service containers
if [ -d /containers/services ]

View File

@ -114,6 +114,10 @@ mount --make-rshared /var
# make / rshared
mount --make-rshared /
# set global ulimits TODO move to /etc/limits.conf?
ulimit -n 1048576
ulimit -p unlimited
# execute other init processes
INITS="$(find /etc/init.d -type f | sort)"
for f in $INITS

View File

@ -25,3 +25,4 @@ FROM scratch
WORKDIR /
ENTRYPOINT []
COPY --from=alpine /usr/bin/runc /usr/bin/
COPY etc etc/

View File

@ -1,4 +1,5 @@
IMAGE=runc
NETWORK=1
DEPS=$(wildcard etc/init.d/*)
include ../package.mk

15
pkg/runc/etc/init.d/010-onboot Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
# start onboot containers, run to completion
if [ -d /containers/onboot ]
then
for f in $(find /containers/onboot -mindepth 1 -maxdepth 1 | sort)
do
base="$(basename $f)"
/bin/mount --bind "$f/rootfs" "$f/rootfs"
mount -o remount,rw "$f/rootfs"
/usr/bin/runc run --bundle "$f" "$(basename $f)"
printf " - $base\n"
done
fi