Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c8381d6

Browse files
committed
Use "docker load" to create "scratch" in hack/make/test-integration-cli (instead of implicitly pulling it from the index)
Creating the "docker save" tarball for "scratch" is pretty simple. I've also extrapolated the "docker build -t busybox ." logic into a separate "hack/make/.ensure-busybox" file so that it can eventually be reused easier. Docker-DCO-1.1-Signed-off-by: Andrew Page <[email protected]> (github: tianon)
1 parent e4114e6 commit c8381d6

3 files changed

Lines changed: 32 additions & 7 deletions

File tree

hack/make/.ensure-busybox

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
if ! docker inspect busybox &> /dev/null; then
4+
if [ -d /docker-busybox ]; then
5+
source "$(dirname "$BASH_SOURCE")/.ensure-scratch"
6+
( set -x; docker build -t busybox /docker-busybox )
7+
else
8+
( set -x; docker pull busybox )
9+
fi
10+
fi

hack/make/.ensure-scratch

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
if ! docker inspect scratch &> /dev/null; then
4+
# let's build a "docker save" tarball for "scratch"
5+
# see https://github.com/dotcloud/docker/pull/5262
6+
# and also https://github.com/dotcloud/docker/issues/4242
7+
mkdir -p /docker-scratch
8+
(
9+
cd /docker-scratch
10+
echo '{"scratch":{"latest":"511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158"}}' > repositories
11+
mkdir -p 511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158
12+
(
13+
cd 511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158
14+
echo '{"id":"511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158","comment":"Imported from -","created":"2013-06-13T14:03:50.821769-07:00","container_config":{"Hostname":"","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":null,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"OnBuild":null},"docker_version":"0.4.0","architecture":"x86_64","Size":0}' > json
15+
echo '1.0' > VERSION
16+
tar -cf layer.tar --files-from /dev/null
17+
)
18+
)
19+
( set -x; tar -cf /docker-scratch.tar -C /docker-scratch . )
20+
( set -x; docker load --input /docker-scratch.tar )
21+
fi

hack/make/test-integration-cli

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,7 @@ bundle_test_integration_cli() {
3030
# pull the busybox image before running the tests
3131
sleep 2
3232

33-
if ! docker inspect busybox &> /dev/null; then
34-
if [ -d /docker-busybox ]; then
35-
( set -x; docker build -t busybox /docker-busybox )
36-
else
37-
( set -x; docker pull busybox )
38-
fi
39-
fi
33+
source "$(dirname "$BASH_SOURCE")/.ensure-busybox"
4034

4135
bundle_test_integration_cli
4236

0 commit comments

Comments
 (0)