cookbook/container: example of building+running docker containers.
This got... long... and complicated. But I think it's a really good demonstration of getting redo to do complicated things elegantly. At least, I hope it is.
This commit is contained in:
parent
01497f55e9
commit
3923a7d3f8
38 changed files with 1375 additions and 7 deletions
25
docs/cookbook/container/default.runlocal.do
Normal file
25
docs/cookbook/container/default.runlocal.do
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
redo-ifchange "$2.fs"
|
||||
|
||||
./need.sh unshare
|
||||
|
||||
set +e
|
||||
unshare -r chroot "$2" /init >$3
|
||||
rv=$?
|
||||
if [ "$rv" != 0 ]; then
|
||||
f=/proc/sys/kernel/unprivileged_userns_clone
|
||||
if [ -e "$f" ]; then
|
||||
read v <$f
|
||||
if [ "$v" -eq 0 ]; then
|
||||
echo "Try: echo 1 >$f" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
f=/proc/sys/kernel/userns_restrict
|
||||
if [ -e "$f" ]; then
|
||||
read v <$f
|
||||
if [ "$v" -ne 0 ]; then
|
||||
echo "Try: echo 0 >$f" >&2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
exit "$rv"
|
||||
Loading…
Add table
Add a link
Reference in a new issue