diff --git a/bin/disk-image-create b/bin/disk-image-create index fb40ec1e..f092c802 100755 --- a/bin/disk-image-create +++ b/bin/disk-image-create @@ -434,7 +434,7 @@ for X in ${!IMAGE_TYPES[@]} ; do elif [ "${IMAGE_TYPES[$X]}" == "docker" ]; then sudo tar -C ${TMP_BUILD_DIR}/mnt -cf - --exclude ./sys \ --exclude ./proc --xattrs --xattrs-include=\* . \ - | docker import - $DOCKER_TARGET + | sudo docker import - $DOCKER_TARGET unset IMAGE_TYPES[$X] fi done diff --git a/lib/img-functions b/lib/img-functions index 908123ce..d02837e0 100644 --- a/lib/img-functions +++ b/lib/img-functions @@ -121,7 +121,9 @@ function finalise_base () { fi fi # Cleanup /tmp in the guest, so there is less cruft left there - unmount_dir $TMP_MOUNT_PATH/tmp + if [ -d "$TMP_MOUNT_PATH/tmp" ]; then + unmount_dir $TMP_MOUNT_PATH/tmp + fi find $TMP_MOUNT_PATH/tmp -maxdepth 1 -mindepth 1 | xargs sudo rm -rf --one-file-system } diff --git a/tests/install_test_deps.sh b/tests/install_test_deps.sh index 031ab196..7b3cc3fb 100755 --- a/tests/install_test_deps.sh +++ b/tests/install_test_deps.sh @@ -4,13 +4,17 @@ set -eux set -o pipefail sudo apt-get update || true -sudo apt-get install -y \ +sudo apt-get install -y --force-yes \ + apt-transport-https \ debootstrap \ + docker.io \ inetutils-ping \ + lsb-release \ kpartx \ qemu-utils \ uuid-runtime || \ sudo yum -y install \ debootstrap \ + docker \ kpartx \ qemu-img diff --git a/tests/run_output_format_test.sh b/tests/run_output_format_test.sh index f42d0ac8..c377032d 100755 --- a/tests/run_output_format_test.sh +++ b/tests/run_output_format_test.sh @@ -26,7 +26,7 @@ function build_test_image() { dest_dir=$(mktemp -d) base_dest=$(basename $dest_dir) - trap "rm -rf $dest_dir; docker rmi $base_dest/image" EXIT + trap "rm -rf $dest_dir; sudo docker rmi $base_dest/image" EXIT ELEMENTS_PATH=$DIB_ELEMENTS:$TEST_ELEMENTS \ $DIB_CMD -x $type_arg --docker-target=$base_dest/image \ @@ -43,7 +43,7 @@ function build_test_image() { echo "Found image $img_path." fi else - if ! docker images | grep $base_dest/image ; then + if ! sudo docker images | grep $base_dest/image ; then echo "Error: No docker image with name $base_dest/image found!" exit 1 else @@ -54,8 +54,8 @@ function build_test_image() { trap EXIT rm -rf $dest_dir - if docker images | grep $base_dest/image ; then - docker rmi $base_dest/image + if sudo docker images | grep $base_dest/image ; then + sudo docker rmi $base_dest/image fi }