1
0
mirror of https://github.com/docker/cli.git synced 2026-01-16 20:22:36 +03:00

Merge pull request #478 from tianon/mkimage-debian

+ contrib: Add contrib/mkimage-debian.sh used to create the tianon/debian images
Upstream-commit: 6d1dd8b41a4cd7630a27c26508d7fa298b401184
Component: engine
This commit is contained in:
Guillaume J. Charmes
2013-04-26 13:51:47 -07:00

View File

@@ -0,0 +1,45 @@
#!/bin/bash
set -e
latestSuite='wheezy'
repo="$1"
suite="${2:-$latestSuite}"
mirror="${3:-http://ftp.us.debian.org/debian}"
if [ ! "$repo" ]; then
echo >&2 "usage: $0 repo [suite [mirror]]"
echo >&2 " ie: $0 tianon/debian squeeze"
exit 1
fi
target="/tmp/docker-rootfs-$$-$RANDOM-debian-$suite"
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
returnTo="$(pwd -P)"
set -x
# bootstrap
mkdir -p "$target"
sudo debootstrap --verbose --variant=minbase --include=iproute,iputils-ping "$suite" "$target" "$mirror"
cd "$target"
# create the image
img=$(sudo tar -c . | docker import -)
# tag suite
docker tag $img $repo $suite
if [ "$suite" = "$latestSuite" ]; then
# tag latest
docker tag $img $repo latest
fi
# test the image
docker run -i -t $repo:$suite echo success
# cleanup
cd "$returnTo"
sudo rm -rf "$target"