From 640dd591fece9915ddc8b57bee191bc86805a52f Mon Sep 17 00:00:00 2001 From: gdm85 Date: Sun, 1 Jun 2014 23:55:16 +0200 Subject: [PATCH] * script to build a base Debian Wheezy docker image --- docker/scripts/build-wheezy.sh | 35 ++++++++++++++++++++++++++++ docker/{ => scripts}/docker-iptables | 0 2 files changed, 35 insertions(+) create mode 100755 docker/scripts/build-wheezy.sh rename docker/{ => scripts}/docker-iptables (100%) diff --git a/docker/scripts/build-wheezy.sh b/docker/scripts/build-wheezy.sh new file mode 100755 index 0000000..0476c85 --- /dev/null +++ b/docker/scripts/build-wheezy.sh @@ -0,0 +1,35 @@ +#!/bin/bash +## @author gdm85 +## original article: http://learndocker.com/how-to-build-a-debian-wheezy-base-container/ +## +## build a base Debian Wheezy +# + +## the distro we are going to use +DISTNAME=wheezy +DEBIAN_REPO=http://ftp.debian.org/debian + +if [ ! $UID -eq 0 ]; then + echo "This script can only be run as root" 1>&2 + exit +fi + +## install prerequisites +## NOTE: may fail on non-Ubuntu/Debian systems +if ! type -P debootstrap; then + apt-get install debootstrap -y || exit $? +fi + +## NOTE: a temporary directory under /tmp is not used because can't be mounted dev/exec +mkdir $DISTNAME || exit $? +TMPDIR=$PWD/$DISTNAME + +debootstrap $DISTNAME $DISTNAME $DEBIAN_REPO && \ +cd $DISTNAME && \ +tar -c . | docker import - $DISTNAME +RV=$? + +# always perform cleanup +rm -rf $TMPDIR + +exit $RV diff --git a/docker/docker-iptables b/docker/scripts/docker-iptables similarity index 100% rename from docker/docker-iptables rename to docker/scripts/docker-iptables