From 718c74ca858984711694e7e2c6443cf0895b306f Mon Sep 17 00:00:00 2001 From: Peter Kolbus Date: Sat, 29 Jun 2019 11:26:51 -0500 Subject: [PATCH] Improve compatibility with firewalled networks * Allow specifying MBEDTLS_DOCKER_REGISTRY for organizations that have a mirroring proxy of Docker Hub * Specify "--network host" during build to ensure use of the host's DNS resolution. --- tests/docker/bionic/Dockerfile | 7 ++++--- tests/scripts/docker_env.sh | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/docker/bionic/Dockerfile b/tests/docker/bionic/Dockerfile index 948e50679..1b2d40f28 100644 --- a/tests/docker/bionic/Dockerfile +++ b/tests/docker/bionic/Dockerfile @@ -21,10 +21,11 @@ # limitations under the License. # # This file is part of Mbed TLS (https://tls.mbed.org) - -FROM ubuntu:bionic - ARG MAKEFLAGS_PARALLEL="" +ARG MY_REGISTRY= + +FROM ${MY_REGISTRY}ubuntu:bionic + ENV DEBIAN_FRONTEND noninteractive diff --git a/tests/scripts/docker_env.sh b/tests/scripts/docker_env.sh index 04efa82e4..8bdc42579 100755 --- a/tests/scripts/docker_env.sh +++ b/tests/scripts/docker_env.sh @@ -14,7 +14,10 @@ # This script expects a Linux x86_64 system with a recent version of Docker # installed and available for use, as well as http/https access. If a proxy # server must be used, invoke this script with the usual environment variables -# (http_proxy and https_proxy) set appropriately. +# (http_proxy and https_proxy) set appropriately. If an alternate Docker +# registry is needed, specify MBEDTLS_DOCKER_REGISTRY to point at the +# host name. +# # # Running this script directly will check for Docker availability and set up # the Docker image. @@ -63,8 +66,10 @@ ${DOCKER} image build \ -t ${DOCKER_IMAGE_TAG} \ --cache-from=${DOCKER_IMAGE_TAG} \ --build-arg MAKEFLAGS_PARALLEL="-j $(nproc)" \ + --network host \ ${http_proxy+--build-arg http_proxy=${http_proxy}} \ ${https_proxy+--build-arg https_proxy=${https_proxy}} \ + ${MBEDTLS_DOCKER_REGISTRY+--build-arg MY_REGISTRY="${MBEDTLS_DOCKER_REGISTRY}/"} \ tests/docker/${MBEDTLS_DOCKER_GUEST} run_in_docker()