microsoft / vscode-docker

Docker Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker
Other
1.18k stars 508 forks source link

Registries login for GHCR always fails. #4261

Closed alherm7 closed 3 months ago

alherm7 commented 3 months ago

I can use the docker CLI to login to our company GHCR but when I use the same personal access token in the VScode docker plugin to log in, i consistenly get a 'Request to https://api.github.com/user/orgs failed with status 403: Forbidden' error. However, when I use the docker cli, all is good. The commands i use in the terminal are the following:

export CR_PAT= echo $CR_PAT | docker login ghcr.io -u alherm7 --password-stdin WARNING! Your password will be stored unencrypted in /Users/ahb/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

Does this occur consistently? Yes Repro steps:

  1. Click on 'Connect Registry'
  2. type in my github username
  3. type in my github personal access token with package read and write scope
  4. expand github section in registry
  5. receive error: 'Request to https://api.github.com/user/orgs failed with status 403: Forbidden'

Version: 1.29.0 OS: darwin OS Release: 23.2.0 Product: Visual Studio Code Product Version: 1.87.2 Language: en

bwateratmsft commented 3 months ago

The Docker extension requires a PAT with slightly higher permissions than the CLI, because of the need to browse images in the registry--something the CLI cannot do. Can you try creating a classic token (not the new fine-grained ones) with the repo and write:packages scopes and see if that works?

AzCode-Bot commented 3 months ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

alherm7 commented 3 months ago

Thanks @bwateratmsft , That did the trick! Now it's working.