nicholasamorim / ansible-role-harbor

An Ansible Role that installs Harbor.
MIT License
24 stars 29 forks source link

docker login won't work if we use a custom port (8443) - redirects to 443 #10

Open ghost opened 5 years ago

ghost commented 5 years ago

This is what you get with a custom port (HTTPS):

CURL:
< HTTP/1.1 401 Unauthorized

< Server: nginx

< Date: Fri, 05 Apr 2019 13:29:45 GMT

< Content-Type: application/json; charset=utf-8

< Content-Length: 87

< Connection: keep-alive

< Docker-Distribution-Api-Version: registry/2.0

< Set-Cookie: sid=b9969f27808d09cd150a27e0122fc068; Path=/; HttpOnly

< Www-Authenticate: Bearer realm="https://DOMAIN.COM/service/token",service="harbor-registry"

<

{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}

* Connection #0 to host  DOMAIN.COM left intact

$ sudo docker login DOMAIN.COM8443

[sudo] password for user:

Username: user

Password:

Error response from daemon: Get https://DOMAIN.COM:8443/v2/: Get https://DOMAIN.COM/service/token?account=user&client_id=docker&offline_token=true&service=harbor-registry: dial tcp 192.168.x.x:443: connect: connection refused

I found what is wrong and will try to fix it. ./config/notary/server-config.postgres.json: "realm": "https://DOMAIN.COM/service/token"

ghost commented 5 years ago

See https://github.com/nicholasamorim/ansible-role-harbor/pull/11 for a fix. It still needs to be tested to know if it works for everyone's cases so we need help writing tests. For me it does work.