I activated 2FA in my gitlab account and created a personal access token. Then I logged in with the access token on different ways.
$ docker login https://dockerhub.my-site.com:5000/some/path?private_token=<personal-access-token>
$ docker login -u <username> -p <personal-access-token> https://dockerhub.my-site.com:5000/some/path
$ docker login https://dockerhub.my-site.com:5000/some/path
None of these methods worked and I'm always getting the same error.
login Error Head "https://dockerhub.my-site.com:5000/some/path": unauthorized: HTTP Basic: Access denied. The provided password or token i... 1.3s
Error response from daemon: Head "https://dockerhub.my-site.com:5000/some/path": unauthorized: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://dockerhub.my-site.com:5000/help/user/profile/account/two_factor_authentication#troubleshooting
When you log in to a Docker registry do not specify HTTPS protocol only domain name and optionally port if different from 443.
In your case run docker login dockerhub.my-site.com:5000
and provide your Gitlab username and your personal access token when prompted.