mirror of
				https://github.com/DaoCloud/public-image-mirror.git
				synced 2025-11-04 16:57:22 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			22 lines
		
	
	
		
			389 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			389 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/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}"
 |