-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
docker login is a command which allows you to both login and register for accounts on Docker Hub and other registries.
If you login with a username that does not exist, the command automatically attempts to register an account for you.
Problems with current design
-
When the user is logging in, the email field is not used.
-
When the user intends to log in and they incorrectly enter their username (either a typo or forgotten), it will unexpectedly attempt to create a new account for them:
$ docker login
Username: bforsh
Password:
Email: ben.firshman@docker.com
Error response from daemon: Registration: "email is already associated with an account"
If they enter a unique email address, it will actually create the account.
- When the user is intending to register, there is no way of checking if the username is already taken, so the user is shown a confusing error if they are attempting to sign up with a username that is already taken.
$ docker login
Username: bfirsh
Password:
Email: bfirsh+123@docker.com
Error response from daemon: Wrong login/password, please try again
Proposed design
Login
We could remove the email field, as proposed in #16183:
$ docker login
Username: bfirsh
Password:
Login succeeded. Your username and authentication token have been saved in /Users/ben/.docker/config.json
If the user incorrectly enters their username, it will fail:
$ docker login
Username: bforsh
Password:
Username does not exist. If you want to sign up for an account, head over to https://hub.docker.com
If the user is using a third-party registry, it will not display the message suggesting to sign up:
$ docker login myregistry.com
Username: bforsh
Password:
Username does not exist.
This message can be produced server-side. A neat side-effect is that this should make it a backwards compatible change for old versions of Docker.
Registration
CLI signups represent a small proportion of total registrations on Docker Hub, many of which may be accidental. For users who intend to register for an account, a message directing them to go to hub.docker.com should be sufficient to get them to sign up. We can also direct users to use hub.docker.com in all of our documentation.
Once you've signed up for an account on Docker Hub, we then have the opportunity to direct you back to the CLI with getting started guides, explanations on how to push images, etc. For a new user, this opportunity to educate may be beneficial.
Docker Engine changes
- The email field should be removed, as proposed in Retire email address field #16183
- Messages returned from the server when logging in should be displayed verbatim (e.g. "Username does not exist. If you want to sign up for an account, head over to https://hub.docker.com")
Docker Hub changes
- Email field should not be required.
- New accounts should not be created.
Other impact
- Registration in old versions of Docker will stop working. The error message returned from the Hub instructing users to sign up should be displayed to the user.
- Various third-party registries (Google Container Registry, Quay, etc) will need to update their documentation.