Docker login returning error - 400 Bad Request

Hi Everyone.

My client has a “docker-group” in their Nexus (3.x) registry. I’m trying to run a docker login -u -p but it keeps returning a 400 - Bad Request error.

There is a reverse proxy in place but I didn’t set it up so I’m a bit blind there… The port specified in the Nexus config is 18080 and the proxy port is 18085. I’m using the default admin credentials (nx-admin permissions).

I’m not having much luck looking through the logs so any assistance will be appreciated.

Kind Regards,
Devon Britton.

An update from my side.

Using cURL to see if I can diagnose the issue any further, I get the following response… This has been sanitised to remove URL’s and IP addresses obviously.

  • Trying…
  • Connected to ( port 18085 (#0)
  • found 127 certificates in /etc/ssl/certs/ca-certificates.crt
  • found 508 certificates in /etc/ssl/certs
  • ALPN, offering http/1.1
  • SSL connection using TLS1.2 / ECDHE_RSA_AES_256_CBC_SHA1
  •    server certificate verification OK
  •    server certificate status verification SKIPPED
  •    common name: * (matched)
  •    server certificate expiration date OK
  •    server certificate activation date OK
  •    certificate public key: RSA
  •    certificate version: #3
  •    subject: C=FR,L=Courbevoie,O=ENGIE SA,OU=BU BENELUX - BE - M&S,CN=*
  •    start date: Mon, 20 Apr 2020 00:00:00 GMT
  •    expire date: Tue, 22 Jun 2021 12:00:00 GMT
  •    issuer: C=US,O=DigiCert Inc,CN=DigiCert SHA2 Secure Server CA
  •    compression: NULL
  • ALPN, server did not agree to a protocol
  • Server auth using Basic with user ‘username’

GET /v2/_catalog HTTP/1.1
Authorization: Basic 'lgdsjfhsd;jlkl;jdkfn
User-Agent: curl/7.47.0
Accept: /

< HTTP/1.1 400 Bad Request
< Content-Type: text/html; charset=us-ascii
< Server: Microsoft-HTTPAPI/2.0
< Date: Mon, 05 Oct 2020 13:25:40 GMT
< Connection: close
< Content-Length: 334

Bad Request

Bad Request - Invalid Hostname

HTTP Error 400. The request hostname is invalid.

* Closing connection 0

It seems like the server is reachable but something is going wrong with the authentication somewhere…I haven’t run into this issue before…

Thanks again for any help.

That seems like an error your reverse proxy might provide.

Returning 400 means that the request was malformed. In other words, the data stream sent by the client to the server didn’t follow the rules. The client SHOULD NOT repeat the request without modifications. It means that the request itself has somehow incorrect or corrupted and the server couldn’t understand it. The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method . Therefore, it prevents the website from being properly displayed. To fix a 400 Bad Request error, it is best to start diagnosing the issue from the client side itself. Complete the steps outlined in this section to help diagnose and correct the error.

  • Check for errors in the URL.
  • Clear Browser Cache and cookies.
  • Clear DNS Cache.
  • Check your File upload Size.
  • Deactivate Browser Extensions.