Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. // Prepare auth registry for usage
  2. func (app *App) PrepareRegistry() error {
  3. app.AuthConfig = types.AuthConfig{
  4. Username: Username,
  5. Password: Password,
  6. ServerAddress: DefaultServer,
  7. }
  8.  
  9. resp, err := app.Client.RegistryLogin(context.Background(), app.AuthConfig)
  10. if err != nil {
  11. panic(err)
  12. }
  13.  
  14. fmt.Println(resp.Status)
  15. if resp.IdentityToken != "" {
  16. app.AuthConfig.IdentityToken = resp.IdentityToken
  17. }
  18.  
  19. app.AuthConfigEncoded, err = command.EncodeAuthToBase64(app.AuthConfig)
  20. return err
  21. }
  22.  
  23. func (app *App) ImagePull() error {
  24.  
  25. opts := types.ImagePullOptions{
  26. All: true,
  27. RegistryAuth: app.AuthConfigEncoded,
  28. PrivilegeFunc: registryAuthentication(app.Name),
  29. }
  30. responseBody, err := app.Client.ImagePull(context.Background(), app.Name, opts)
  31. defer responseBody.Close()
  32. if err != nil {
  33. return err
  34. }
  35. return nil
  36. }
  37.  
  38. Login Succeeded
  39. 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