Last active
November 20, 2023 07:23
-
-
Save testwill/4e63bde01d4d90d5f935eed92acf7bb4 to your computer and use it in GitHub Desktop.
skopeo login registry Docker Insecure Skip TLS Verify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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