nexus-public icon indicating copy to clipboard operation
nexus-public copied to clipboard

500 Internal Server Error when docker login

Open linqqq2001 opened this issue 10 months ago • 18 comments

I ran nexus in docker.The image is sonatype/nexus3:3.81.1-alpine.

When I use command: docker login, the log showed:

2025-06-15 23:39:49,401+0000 WARN [qtp683327178-239] *SYSTEM org.eclipse.jetty.server.Response - writeError: status=500, message=java.lang.NullPointerException: Cannot invoke "org.eclipse.jetty.server.Request.getHeadersNanoTime()" because "request" is null, response=ErrorResponse@757ac2bc{500,GET@d79d22b http://docker.mookai.cn:9640/v2/ HTTP/1.1} java.lang.NullPointerException: Cannot invoke "org.eclipse.jetty.server.Request.getHeadersNanoTime()" because "request" is null at org.eclipse.jetty.server.Request.getTimeStamp(Request.java:241) at io.dropwizard.metrics.jetty12.AbstractInstrumentedHandler.handle(AbstractInstrumentedHandler.java:282) at org.sonatype.nexus.repository.docker.internal.DockerRequestHandler.handle(DockerRequestHandler.java:83) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:151) at org.eclipse.jetty.server.Server.handle(Server.java:182) at org.eclipse.jetty.server.internal.HttpChannelState$HandlerInvoker.run(HttpChannelState.java:662) at org.eclipse.jetty.server.internal.HttpConnection.onFillable(HttpConnection.java:416) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:322) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:99) at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53) at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:480) at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:443) at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:293) at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:201) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:311) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:979) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1209) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1164) at java.base/java.lang.Thread.run(Thread.java:840)

linqqq2001 avatar Jun 15 '25 23:06 linqqq2001

For me there is the same problem

afustini avatar Jun 16 '25 13:06 afustini

same problem!

marcoberri avatar Jun 16 '25 14:06 marcoberri

same problem!

rickygalDS2 avatar Jun 18 '25 18:06 rickygalDS2

same problem!

evrinoma avatar Jun 19 '25 08:06 evrinoma

same problem!

isaacnugroho avatar Jun 21 '25 09:06 isaacnugroho

Tried with docker engine 27.5 and 28, broken for both.

Likely related to the Jetty 12 upgrade.

morfav avatar Jun 22 '25 22:06 morfav

same problem

smskin avatar Jun 26 '25 12:06 smskin

+1

hunasdf avatar Jun 27 '25 20:06 hunasdf

Same issue

ahmedelsaeedismail avatar Jun 28 '25 15:06 ahmedelsaeedismail

any update?

dujiepeng avatar Jul 07 '25 08:07 dujiepeng

+1

voiddev90 avatar Jul 11 '25 11:07 voiddev90

Joining club

TreeAtOr avatar Jul 12 '25 21:07 TreeAtOr

Still broken on 3.82.0-08 alpine.

It is also affecting /v1 REST endpoints, not only "docker login" command.

morfav avatar Jul 13 '25 21:07 morfav

any workarounds for this?

Tqqn avatar Jul 14 '25 07:07 Tqqn

yeah, I also have the same problem

My work around with nginx proxy is something like this, and this worked.

  location /v2/ {
    # Docker registry API workaround - rewrite /v2/ to /repository/docker/v2/
    rewrite ^/v2/(.*)$ /repository/docker/v2/$1 break;

    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Scheme $scheme;
    proxy_set_header X-Forwarded-Proto  $scheme;
    proxy_set_header X-Forwarded-For    $remote_addr;
    proxy_set_header X-Real-IP          $remote_addr;

    proxy_pass       http://<IP>:8081;

    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    proxy_http_version 1.1;
  }

reynold-lariza avatar Jul 14 '25 16:07 reynold-lariza

yeah, I also have the same problem

My work around with nginx proxy is something like this, and this worked.

  location /v2/ {
    # Docker registry API workaround - rewrite /v2/ to /repository/docker/v2/
    rewrite ^/v2/(.*)$ /repository/docker/v2/$1 break;

    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Scheme $scheme;
    proxy_set_header X-Forwarded-Proto  $scheme;
    proxy_set_header X-Forwarded-For    $remote_addr;
    proxy_set_header X-Real-IP          $remote_addr;

    proxy_pass       http://<IP>:8081;

    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    proxy_http_version 1.1;
  }

In version 3.82.0-08, only v1 APIs appear in Settings→System→API, not v2. After slight modifications to your rewrite, it worked.

 rewrite ^/v2/(.*)$ /repository/{your_repository_name}/v1/$1 break;

However, compatibility risks may exist since the docker client requests v2. This should hint at what's truly occurring; proceed with caution in your environment.

KennanChan avatar Jul 23 '25 09:07 KennanChan

I struggled also with this issue and found the following post: https://stackoverflow.com/questions/49127414/docker-login-on-private-nexus-error-response-from-daemon-login-attempt-to-ht/49173667

Just enabled a separate HTTP connector on a different port and activated the docker bearer token realm - as described in the post. Now it works as expected.

andidribbusch avatar Jul 27 '25 13:07 andidribbusch