Add LOCAL_REGISTRY_INTERFACE option to bind the insecure docker registry to alternate NICs

Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
This commit is contained in:
Josh Kneubuhl 2022-08-06 07:31:24 -04:00
parent 25b02a5f5a
commit cd447f2914
2 changed files with 7 additions and 2 deletions

View file

@ -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

View file

@ -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