Hello,
I’m trying to use the Go docker client to pull images from my company’s artifactory. I’ve setup the client as follows :
dockerClient, _ := client.NewClientWithOpts(
client.FromEnv,
client.WithAPIVersionNegotiation(),
)
// Custom function to retrieve the credentials from host store
username, token, _ := getCredentialsFromHelper()
authConfig := registry.AuthConfig{
Username: username,
// Password: token,
// IdentityToken: token,
RegistryToken: token,
ServerAddress: "my-company-artifactory.com",
}
authStr, _ := registry.EncodeAuthConfig(authConfig)
reader, err := dockerClient.ImagePull(
context.Background(),
"my-company-artifactory.com/my-image:latest",
image.PullOptions{
RegistryAuth: authStr,
},
)
if err != nil {
panic(err)
}
For the sake of clarity, I removed error handling, except where I get my actual error :
panic: Error response from daemon: Get "https://my-company-artifactory.com/v2/": EOF
I’m able to use the docker cli to pull the exact same image (meaning that my stored credentials are working just fine). I tried to look at the implementation of the docker CLI but I was not able to see what I was missing. Does anyone has a clue ?