Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

Better error prompt when Docker Desktop is installed #26

Closed
1 task
shizhMSFT opened this issue Jan 10, 2023 · 6 comments · Fixed by #77
Closed
1 task

Better error prompt when Docker Desktop is installed #26

shizhMSFT opened this issue Jan 10, 2023 · 6 comments · Fixed by #77
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@shizhMSFT
Copy link
Contributor

What is the version of your ORAS CLI

v0.16.0

What would you like to be added?

When Docker Desktop for Windows or macOS installed and is not currently running, running oras will encounter an error.

$ oras login $reg --username $name --password $secret
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error: error storing credentials - err: exit status 1, out: `Post "[http://ipc/registry/credstore-updated":](http://ipc/registry/credstore-updated%22:) open \\.\pipe\dockerBackendApiServer: The system cannot find the file specified.`

It is better to have something like

$ oras login $reg --username $name --password $secret
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error: error storing credentials: credential store is configured to `desktop` and docker desktop seems not running

It would be even better to give users an option to update the credential store. A sample output on Windows could be

$ oras login $reg --username $name --password $secret
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error: error storing credentials: credential store is configured to `desktop` and docker desktop seems not running
Do you want to update the global credential store to `wincred`? [y/N]

Why is this needed for ORAS?

oras in general does not require docker or dockerd. oras reuses the docker config file and docker desktop sets the credential store to docker desktop when docker desktop is installed.

Here are the scenarios for the complete behavior.

  • Scenario 1: Running oras on Linux without docker installed
    • oras works and will save the credentials to ~/.docker/config.json on oras login.
  • Scenario 2: Running oras on Linux with docker installed
    • oras works and reuses the docker credentials in ~/.docker/config.json. If credential store is configured, oras also re-uses the credential store.
  • Scenario 3: Running oras on Windows without docker desktop installed
    • Same as Scenario 1
  • Scenario 4: Running oras on Windows with docker desktop installed
    • oras works but reuses the docker credentials in ~/.docker/config.json. By default, it requires docker desktop running to run oras.
    • Mitigation step: Edit ~/.docker/config.json and replace desktop with wincred for the credStore field.
  • Scenario 5: Running oras on macOS without docker desktop installed
    • Same as Scenario 1
  • Scenario 6: Running oras on macOS with docker desktop installed
    • Same as Scenario 4 but replace desktop with osxkeychain.

It would be better to let the users know what's the next steps, such as run Docker Desktop or update the config, when they encounter the weird pipe error.

Are you willing to submit PRs to contribute to this feature?

  • Yes, I am willing to implement it.
@wangxiaoxuan273
Copy link
Collaborator

wangxiaoxuan273 commented Apr 27, 2023

Tested on WSL, Windows and Mac M1 without Docker Desktop running, it looks like Docker has fixed this issue.
Screen shot from WSL terminal, on other os it looks identical.
image

@shizhMSFT
Copy link
Contributor Author

Closing this issue as it is resolved from the docker desktop side.

@Wwwsylvia
Copy link
Member

It looks like this issue still exists.

@Wwwsylvia Wwwsylvia reopened this Jun 7, 2023
@wangxiaoxuan273
Copy link
Collaborator

wangxiaoxuan273 commented Jun 8, 2023

Related: We also need to check if the credentials helper binaries can be found before we use it. #68 (comment) I think it's better to address this problem in a separate issue, as it is quite complicated how native store is used and errors handled in oras-cli. Created issue #78.

@wangxiaoxuan273
Copy link
Collaborator

The current error message is different from the original one (see the issue description above). I believe this is a new problem caused by a docker bug on WSL, though apparently it is also "got error when docker engine is not running".
Screenshot 2023-06-15 095217

@wangxiaoxuan273
Copy link
Collaborator

Changed the displayed error message of the current scenario.
Screenshot 2023-06-15 104700

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants