From cb53fe5ed13825ecfdeb62e0fa49f8c414a32e69 Mon Sep 17 00:00:00 2001 From: Karanbir Singh Date: Fri, 4 Apr 2014 00:20:56 +0100 Subject: [PATCH] adapt the import script to just give us a tarball instead --- docker/img2tar.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 docker/img2tar.sh diff --git a/docker/img2tar.sh b/docker/img2tar.sh new file mode 100644 index 0000000..f392a6f --- /dev/null +++ b/docker/img2tar.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# +# This script imports a raw image into Docker consumeable tarball. It takes one +# arguments: the name of the image file + +usage() { + echo "usage: $(basename $0) " + exit 1 +} + +image="$1" + +if [[ -z $1 ]]; then + usage +fi + +mount="$(mktemp -d --tmpdir)" +mount -o loop "$image" "$mount" + +cd "$mount" +tar -cpSf - --acls --selinux --xattrs * | bzip2 > ${image}.tar.bz2 +cd - >& /dev/null +umount "$mount" +rmdir "$mount"