Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script for running docker in Chrome OS
#!/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
You can’t perform that action at this time.