如何从自定义dockerregistry与图像拖拉?

使用docker源如何从自定义registry中拉出图像? 由于使用这样的代码

// 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 

ServerAddress是registry.gitlab.com,而不是registry-1.docker.io

你检查身份令牌吗? 这可能会导致身份validation问题。

一条build议:
Docker客户端

这工作正常,因为我可以看到你没有指定端点 。 我想你应该添加这个信息。