Add onshutdown support to runc

This will run any containers in `/containers/onshutdown` on a clean
shutdown.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2017-07-18 11:51:52 +01:00
parent fe8f979da5
commit c6aa7b9053

View File

@ -0,0 +1,15 @@
#!/bin/sh
# start onshutdown containers, run to completion
if [ -d /containers/onshutdown ]
then
for f in $(find /containers/onshutdown -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