Merge pull request #10230 from tianon/emptyfs

Update emptyfs support to work properly if scratch is already an image
This commit is contained in:
Tibor Vass 2015-01-27 15:01:42 -05:00
commit bb4025c4e2
3 changed files with 8 additions and 6 deletions

View File

@ -1,8 +1,8 @@
#!/bin/bash
set -e
if ! docker inspect busybox &> /dev/null; then
if [ -d /docker-busybox ]; then
source "$(dirname "$BASH_SOURCE")/.ensure-scratch"
( set -x; docker build -t busybox /docker-busybox )
else
( set -x; docker pull busybox )

View File

@ -1,12 +1,13 @@
#!/bin/bash
set -e
if ! docker inspect scratch &> /dev/null; then
if ! docker inspect emptyfs &> /dev/null; then
# let's build a "docker save" tarball for "emptyfs"
# see https://github.com/docker/docker/pull/5262
# and also https://github.com/docker/docker/issues/4242
mkdir -p /docker-scratch
dir="$(mktemp -d)"
(
cd /docker-scratch
cd "$dir"
echo '{"emptyfs":{"latest":"511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158"}}' > repositories
mkdir -p 511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158
(
@ -16,6 +17,6 @@ if ! docker inspect scratch &> /dev/null; then
tar -cf layer.tar --files-from /dev/null
)
)
( set -x; tar -cf /docker-scratch.tar -C /docker-scratch . )
( set -x; docker load --input /docker-scratch.tar )
( set -x; tar -cC "$dir" . | docker load )
rm -rf "$dir"
fi

View File

@ -20,6 +20,7 @@ bundle_test_integration_cli() {
sleep 2
source "$(dirname "$BASH_SOURCE")/.ensure-busybox"
source "$(dirname "$BASH_SOURCE")/.ensure-emptyfs"
bundle_test_integration_cli
}; then