-
-
Save druonysus/e3789cc048461548cdc1565de76c6f88 to your computer and use it in GitHub Desktop.
Script for running docker in Chrome OS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## Requires custom kernel to be installed in Chrome OS | |
## Copies files from my archlinux chroot into a temp folder and runs docker from there. | |
## Running this on boot of Chrome OS so my version of the docker daemon is upgraded by | |
## pacman in the chroot. | |
set -e | |
chroot=/usr/local/chroots/arch | |
run=/usr/local/tmp/docker | |
[ -f /etc/init/crouton.conf -a `whoami` = root ] || { | |
echo "$0: must be run as root from Chrome OS" | |
exit 2 | |
} | |
egrep -q '^docker:' /etc/group || { | |
echo "$0: group docker not found, add something like 'docker:x:996:chronos' to /etc/group - as GID use same as docker group in the chroot" | |
exit 2 | |
} | |
pgrep -x docker > /dev/null && { | |
echo "$0: docker is already running" | |
exit 1 | |
} | |
[ -d /sys/fs/cgroup/cpuset ] || { | |
mkdir -p /sys/fs/cgroup/cpuset | |
mount -t cgroup none /sys/fs/cgroup/cpuset -o cpuset | |
} | |
mkdir -p $run | |
cp -v $chroot/usr/bin/docker $chroot/usr/lib/docker/dockerinit $chroot/usr/lib/libdevmapper* $run | |
export LD_LIBRARY_PATH=$run | |
$run/docker -D -d -H unix:///tmp/docker.sock "$@" > $chroot/var/log/docker.log 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment