mirror of https://github.com/docker/docs.git
integration helpers: add start_with_busybox
starts an engine with a preloaded busybox without pulling (much faster). Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
7865004ec9
commit
0bf6cf6dc9
|
|
@ -27,6 +27,8 @@ BASE_PORT=$(( ( RANDOM % 1000 ) + 5000 ))
|
|||
STORAGE_DRIVER=${STORAGE_DRIVER:-aufs}
|
||||
EXEC_DRIVER=${EXEC_DRIVER:-native}
|
||||
|
||||
BUSYBOX_IMAGE="$BATS_TMPDIR/busybox.tgz"
|
||||
|
||||
# Join an array with a given separator.
|
||||
function join() {
|
||||
local IFS="$1"
|
||||
|
|
@ -149,6 +151,22 @@ function swarm_join_cleanup() {
|
|||
done
|
||||
}
|
||||
|
||||
function start_docker_with_busybox() {
|
||||
# Preload busybox if not available.
|
||||
[ "$(docker_host images -q busybox)" ] || docker_host pull busybox
|
||||
[ -f "$BUSYBOX_IMAGE" ] || docker_host save -o "$BUSYBOX_IMAGE" busybox
|
||||
|
||||
# Start the docker instances.
|
||||
local current=${#DOCKER_CONTAINERS[@]}
|
||||
start_docker "$@"
|
||||
local new=${#DOCKER_CONTAINERS[@]}
|
||||
|
||||
# Load busybox on the new instances.
|
||||
for ((i=current; i < new; i++)); do
|
||||
docker -H ${HOSTS[$i]} load -i "$BUSYBOX_IMAGE"
|
||||
done
|
||||
}
|
||||
|
||||
# Start N docker engines.
|
||||
function start_docker() {
|
||||
local current=${#DOCKER_CONTAINERS[@]}
|
||||
|
|
|
|||
Loading…
Reference in New Issue