mirror of
https://github.com/DaoCloud/public-image-mirror.git
synced 2025-08-08 18:18:55 +08:00
Fix target sync image
This commit is contained in:
21
hack/real-image.sh
Executable file
21
hack/real-image.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function guess_image() {
|
||||
local image="${1}"
|
||||
|
||||
if [[ -z "${image}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "${image}" =~ ^"docker.io/"* ]]; then
|
||||
image="registry-1.${image}"
|
||||
fi
|
||||
|
||||
if [[ "${image}" =~ ^"registry-1.docker.io/"[^/]+$ ]]; then
|
||||
image="registry-1.docker.io/library/${image#*/}"
|
||||
fi
|
||||
|
||||
echo "${image}"
|
||||
}
|
||||
|
||||
guess_image "${1}"
|
Reference in New Issue
Block a user