Make toolbox compatible with AR and GCR

Currently, toolbox only pulls images from GCR. To be able to pull
from AR, we regex match on AR host
and identify the corresponding registry host. docker-credential-gcr
needs to be run before using toolbox.

TEST=Tested locally by copying the script to a COS VM.
RELEASE_NOTE=Make toolbox compatible with AR and GCR

Change-Id: Ib2981d081e8efbe74fb0ea59920b7f0cfe19582d
diff --git a/toolbox b/toolbox
index 46fe4e5..efde852 100755
--- a/toolbox
+++ b/toolbox
@@ -58,6 +58,10 @@
 		if [[ "${TOOLBOX_DOCKER_IMAGE}" =~ ^[a-z.]* ]]; then
 			# Get a host part of the container name
+		elif [[ "${TOOLBOX_DOCKER_IMAGE}" =~ ^[0-9a-z.-]* ]]; then
+			registry_host="${TOOLBOX_DOCKER_IMAGE/*/}"
+		fi
+		if [[ -n "${registry_host}" ]]; then
 			# docker-credential-gcr can fail if it runs in a
 			# non-GCP env, so let it fail and proceed without
 			# --user flag in this case