Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 3c0cf29

Browse files
committed
Improve error message if the user is not logged in
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>
1 parent f8ebdf6 commit 3c0cf29

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

internal/provider/provider.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,14 @@ func WithExperimental() Ops {
187187
func getToken(opts Options) (string, error) {
188188
if opts.auth.Username == "" {
189189
return "", fmt.Errorf(`You need to be logged in to Docker Hub to use the scan feature.
190-
please login to Docker Hub using the Docker Login command`)
190+
191+
If you are not using Docker Desktop, either
192+
- use the "docker login" CLI command with a username and password. Note this will not work if
193+
2FA is required or if SSO enforcement is enabled on Docker Hub; or
194+
- use the "docker login" CLI command with a username and Personal Access Token. This requires
195+
a token to be generated in advance.
196+
197+
If you are using Docker Desktop: login via the UI or whale menu`)
191198
}
192199
h := hub.GetInstance()
193200
jwks, err := h.FetchJwks()

0 commit comments

Comments
 (0)