Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reproduce private pulling issue + poc a fix #236

Closed

Conversation

jhchabran
Copy link

Follow-up to #126 (comment)

I spent some time exploring to understand if something was wrong on my side or if there was an issue and managed to pull private images with the crude fix that'll find here.

The code that handles the authentication seems to make assumptions about ~/.docker/config.json that do not match the structure of that file.

# ~/.docker/config.json 
{
  "auths": {
    "https://index.docker.io/v1/": {}
  },
  "credHelpers": {
    "asia.gcr.io": "gcloud",
    "eu.gcr.io": "gcloud",
    "gcr.io": "gcloud",
    "marketplace.gcr.io": "gcloud",
    "staging-k8s.gcr.io": "gcloud",
    "us-central1-docker.pkg.dev": "gcloud",
    "us.gcr.io": "gcloud"
  },
  "credsStore": "desktop"
}

But the original code tries to look for us.gcr.io if that's what I set to the registry attr on the oci_pull. It then takes a look at the credsStore which will is set to desktop and doesn't know how to find my private image.

The fix is to instead iterate on the credHelpers if we don't find a matching entry under "auths", which I very crudely implemented.

I have included in my commit the modifications I did to test the code locally, which allowed me to successfully pull the image.

At this stage, I think it's best for me to reach out, as I don't know what would be the best solution to write a proper e2e test for such a patch. With some guidance, I could implement the fix properly, though I'm totally okay if you want to take over.

@thesayyn
Copy link
Collaborator

closing in favor of #237

@thesayyn thesayyn closed this May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants