mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 06:45:16 +01:00
132e790735
To wait for the docker deamon, curl requests are sent. However, if a http proxy is set, it will respond instead of the docker daemon. To avoid this, we send docker ps command instead of curl command.
36 lines
779 B
Bash
36 lines
779 B
Bash
source $stdenv/setup
|
|
|
|
mkdir -p /var/lib/docker
|
|
mkfs.ext4 /dev/vda
|
|
mount -t ext4 /dev/vda /var/lib/docker
|
|
|
|
modprobe virtio_net
|
|
dhclient eth0
|
|
|
|
mkdir -p /etc/ssl/certs/
|
|
cp "$certs" "/etc/ssl/certs/"
|
|
|
|
# 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
|
|
fi
|
|
fi
|
|
done
|
|
|
|
# run docker daemon
|
|
dockerd -H tcp://127.0.0.1:5555 -H unix:///var/run/docker.sock &
|
|
|
|
until docker ps 2>/dev/null; do
|
|
printf '.'
|
|
sleep 1
|
|
done
|
|
|
|
rm -r $out
|
|
|
|
docker pull ${imageId}
|
|
docker save ${imageId} > $out
|