From cd447f29148770890ff2e6534ad0b66fdef1c0cf Mon Sep 17 00:00:00 2001 From: Josh Kneubuhl Date: Sat, 6 Aug 2022 07:31:24 -0400 Subject: [PATCH] Add LOCAL_REGISTRY_INTERFACE option to bind the insecure docker registry to alternate NICs Signed-off-by: Josh Kneubuhl --- test-network-k8s/network | 1 + test-network-k8s/scripts/kind.sh | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/test-network-k8s/network b/test-network-k8s/network index db1eb2f3..1b875963 100755 --- a/test-network-k8s/network +++ b/test-network-k8s/network @@ -53,6 +53,7 @@ context LOG_FILE network.log context DEBUG_FILE network-debug.log context LOG_ERROR_LINES 2 context LOCAL_REGISTRY_NAME kind-registry +context LOCAL_REGISTRY_INTERFACE 127.0.0.1 context LOCAL_REGISTRY_PORT 5000 context STAGE_DOCKER_IMAGES false context NGINX_HTTP_PORT 80 diff --git a/test-network-k8s/scripts/kind.sh b/test-network-k8s/scripts/kind.sh index 69438856..afeb8bf4 100755 --- a/test-network-k8s/scripts/kind.sh +++ b/test-network-k8s/scripts/kind.sh @@ -80,11 +80,15 @@ function launch_docker_registry() { # create registry container unless it already exists local reg_name=${LOCAL_REGISTRY_NAME} local reg_port=${LOCAL_REGISTRY_PORT} + local reg_interface=${LOCAL_REGISTRY_INTERFACE} running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)" if [ "${running}" != 'true' ]; then - docker run \ - -d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" \ + docker run \ + --detach \ + --restart always \ + --name "${reg_name}" \ + --publish "${reg_interface}:${reg_port}:5000" \ registry:2 fi