2015-11-19 12:11:17 +00:00
|
|
|
source $stdenv/setup
|
|
|
|
|
2017-05-26 17:06:24 +01:00
|
|
|
mkdir -p /var/lib/docker
|
|
|
|
mkfs.ext4 /dev/vda
|
|
|
|
mount -t ext4 /dev/vda /var/lib/docker
|
2016-01-27 19:48:04 +00:00
|
|
|
|
2017-05-26 17:06:24 +01:00
|
|
|
modprobe virtio_net
|
|
|
|
dhclient eth0
|
2015-11-19 12:11:17 +00:00
|
|
|
|
2017-05-26 17:06:24 +01:00
|
|
|
mkdir -p /etc/ssl/certs/
|
|
|
|
cp "$certs" "/etc/ssl/certs/"
|
2015-11-19 12:11:17 +00:00
|
|
|
|
2017-05-26 17:06:24 +01:00
|
|
|
# from https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount
|
|
|
|
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
|
|
|
|
cd /sys/fs/cgroup
|
|
|
|
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
|
|
|
|
mkdir -p $sys
|
|
|
|
if ! mountpoint -q $sys; then
|
|
|
|
if ! mount -n -t cgroup -o $sys cgroup $sys; then
|
|
|
|
rmdir $sys || true
|
2015-11-19 12:11:17 +00:00
|
|
|
fi
|
2017-05-26 17:06:24 +01:00
|
|
|
fi
|
|
|
|
done
|
2015-11-19 12:11:17 +00:00
|
|
|
|
2017-05-26 17:06:24 +01:00
|
|
|
# run docker daemon
|
|
|
|
dockerd -H tcp://127.0.0.1:5555 -H unix:///var/run/docker.sock &
|
2015-11-19 12:11:17 +00:00
|
|
|
|
2017-05-26 17:06:24 +01:00
|
|
|
until $(curl --output /dev/null --silent --connect-timeout 2 http://127.0.0.1:5555); do
|
|
|
|
printf '.'
|
|
|
|
sleep 1
|
|
|
|
done
|
2015-11-19 12:11:17 +00:00
|
|
|
|
2017-05-26 17:06:24 +01:00
|
|
|
rm -r $out
|
2015-11-19 12:11:17 +00:00
|
|
|
|
2017-05-26 17:06:24 +01:00
|
|
|
docker pull ${imageId}
|
|
|
|
docker save ${imageId} > $out
|