Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Improve error message if the user is not logged in #202

Merged
merged 3 commits into from
Aug 25, 2022

Conversation

djs55
Copy link
Contributor

@djs55 djs55 commented Jul 1, 2022

- What I did

Improved the error message when not logged in. The main problem is that the suggestion to "use the Docker Login command" will not work easily if

  • 2FA is required
  • SSO is being enforced (so no old password logins allowed)

An advanced user can figure this out by using a PAT, but the simplest thing for most users is to log in via the Docker Desktop UI which will handle the 2FA/SSO for you transparently.

- How I did it

I listed the options in the message, leaving the simplest one for new users at the end.

- How to verify it

Before if you docker logout:

> .\docker-scan.exe scan alpine:latest
failed to get DockerScanID: You need to be logged in to Docker Hub to use scan feature.
please login to Docker Hub using the Docker Login command

After this change if you docker logout :

> .\docker-scan.exe scan alpine:latest
failed to get DockerScanID: You need to be logged in to Docker Hub to use the scan feature.

If you are not using Docker Desktop, either
- use the "docker login" CLI command with a username and password. Note this will not work if
  2FA is required or if SSO enforcement is enabled on Docker Hub; or
- use the "docker login" CLI command with a username and Personal Access Token. This requires
  a token to be generated in advance.

If you are using Docker Desktop: login via the UI or whale menu

- Description for the changelog

  • Improve the error message if you are currently logged out.

- A picture of a cute animal (not mandatory)

image

fix linter issue on go.mod validation
Copy link
Collaborator

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

djs55 added 2 commits August 25, 2022 14:04
Previously the error message prompted the user to `docker login`, but
this will not work if
- 2FA is required
- SSO is enabled with enfocement on Docker Hub,
  see https://docs.docker.com/single-sign-on/#enforce-sso-in-docker-hub

The most reliable way to login is through the Docker Desktop UI, since
the SSO/2FA flows are all handled automatically (via the web browser)

Try to improve the error message by explaining the options.

Signed-off-by: David Scott <dave@recoil.org>
Copy link
Contributor

@eunomie eunomie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eunomie eunomie merged commit ede4a1a into docker:main Aug 25, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants