docker login failed with unsupported protocol scheme error

After a few days investigation, I still can't use docker to login the registry. If I use docker login my-registry-domain, will get this error message:

Error response from daemon: Get https://my-registry-domain/v2/: Get /jwt/auth?account=my-acount&client_id=docker&offline_token=true&service=container_registry: unsupported protocol scheme ""

It looks like the realm config is incorrect so that I can't get authorized by gitlab-ce instance. Refering to gitlab-org/gitlab-ce#17991, I think the right realm should be https://my-gitlab-domain/jwt/auth instead of just /jwt/auth. After I edited registry config.yml manually adding gitlab domain, I will get error like this:

Error response from daemon: Get https://my-registry-domain/v2/: received unexpected HTTP status: 502 Bad Gateway

my registry config in gitlab.rb:

gitlab_rails['registry_enabled'] = true
gitlab_rails['registry_host'] = "my-registry-domain"
registry['enable'] = true
registry['dir'] = "/opt/gitlab/registry"
registry['registry_http_addr'] = "localhost:5000"  # without this the registry won't listen on the 5000 port

My installation information:

Ubuntu 14.04 LTS

omnibus-gitlab package 8.8.3, with external nginx