Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Prepare auth registry for usage
- func (app *App) PrepareRegistry() error {
- app.AuthConfig = types.AuthConfig{
- Username: Username,
- Password: Password,
- ServerAddress: DefaultServer,
- }
- resp, err := app.Client.RegistryLogin(context.Background(), app.AuthConfig)
- if err != nil {
- panic(err)
- }
- fmt.Println(resp.Status)
- if resp.IdentityToken != "" {
- app.AuthConfig.IdentityToken = resp.IdentityToken
- }
- app.AuthConfigEncoded, err = command.EncodeAuthToBase64(app.AuthConfig)
- return err
- }
- func (app *App) ImagePull() error {
- opts := types.ImagePullOptions{
- All: true,
- RegistryAuth: app.AuthConfigEncoded,
- PrivilegeFunc: registryAuthentication(app.Name),
- }
- responseBody, err := app.Client.ImagePull(context.Background(), app.Name, opts)
- defer responseBody.Close()
- if err != nil {
- return err
- }
- return nil
- }
- Login Succeeded
- panic: Error response from daemon: Get https://registry-1.docker.io/v2/shalakhin/blender/tags/list: unauthorized: incorrect username or password
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement