Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Copy container image with google/go-containerregistry

An example of copying docker image, with simple username password, between two registries with crane.

TL,DR

Use multiple keychain and implement KeyChain interface

func (obj MyOjbect) Resolve(target authn.Resource) (authn.Authenticator, error) {
	reg := target.RegistryStr()
	if strings.Contains(src url, reg) {
		return &authn.Basic{
			Username: src username,
			Password: src password,
		}, nil
	} else {
		return &authn.Basic{
			Username: dest username,
			Password: dest password,
		}, nil
	}
}

func main() {
    	_ = crane.Copy(src url, dest url, crane.WithAuthFromKeychain(obj))
}

Credits

About

copy image with crane

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages