Skip to content

Instantly share code, notes, and snippets.

@testwill
Last active November 20, 2023 07:23
Show Gist options
  • Select an option

  • Save testwill/4e63bde01d4d90d5f935eed92acf7bb4 to your computer and use it in GitHub Desktop.

Select an option

Save testwill/4e63bde01d4d90d5f935eed92acf7bb4 to your computer and use it in GitHub Desktop.
skopeo login registry Docker Insecure Skip TLS Verify
package main
import (
"context"
"os"
"github.com/containers/image/v5/types"
"github.com/containers/common/pkg/auth"
)
type loginOptions struct {
loginOpts auth.LoginOptions
}
func main() {
opts := loginOptions{
loginOpts: auth.LoginOptions{
Password: "Harbor12345",
Username: "admin",
Stdin: os.Stdin,
Stdout: os.Stdout,
},
}
ctx := context.Background()
sys := types.SystemContext{}
sys.DockerInsecureSkipTLSVerify = types.NewOptionalBool(true)
err := auth.Login(ctx, &sys, &opts.loginOpts, []string{"192.168.10.145:443"})
if err != nil {
panic(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment