Skip to content

Commit

Permalink
Adding validation to make sure the current registry running has the r…
Browse files Browse the repository at this point in the history
…ight mapping ports configuration
  • Loading branch information
josecordaz committed Feb 23, 2022
1 parent e222041 commit cb76651
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/kind-with-registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ if [ "${running}" != 'true' ]; then
docker run \
-d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" \
registry:2
else
# Validate the ports used by the running register are the ones we need.
right_mapping_ports="5000/tcp -> 127.0.0.1:${reg_port}"
registry_port=$(docker port ${reg_name})
if [ "${registry_port}" != "${right_mapping_ports}" ]; then
echo "It seems the current registry is running on different port configuration than expected:\n\n Current => ($registry_port) \n Expected ($right_mapping_ports). \n\nTry deleting registry manually using 'docker rm -f $reg_name' "
exit 1
fi
fi

reg_host="${reg_name}"
Expand Down

0 comments on commit cb76651

Please sign in to comment.