如何防止 url 使用 Docker 在 EventStore 中重写?

How can I prevent url re-writing in EventStore using Docker?

我正在尝试 运行 Docker 中的服务器 (EventStore),在本例中是他们自己的图像。我正在 运行 使用 -P 标志连接此图像以分配外部端口。 (我的用法使得特定端口分配不切实际。)

当我启动 EventStore 的图像时,端口 2113(他们的 Web 端口)被映射到某个高端口,例如 33125。如果我在浏览器中输入 (my_ip):33125,它会被重写为某些东西喜欢 (my_ip):2113/web/。当然,在Docker之外的2113端口就没有任何意义了!

如何防止重写,或者至少将其全部包含在 Docker 中?

您遇到了一个已知问题。 docs says:

Note : The admin UI and atom feeds will only work if you publish the node's http port to a matching port on the host. (i.e. you need to run the container with -p 2113:2113)

这是未解决的问题:

https://github.com/EventStore/eventstore-docker/issues/6

好像是 EventStore 做的内部检查,所以很难从服务器代码外部解决。

现在可以设置 EVENTSTORE_EXT_HTTP_PORT 环境变量来告诉 eventstore 端口映射是如何完成的。例如,如果 EVENTSTORE_EXT_HTTP_PORT 的值为 52040,则端口映射应为 -p 52040:2113.

您可以通过eventstore的文档找到更多信息: https://eventstore.com/docs/server/command-line-arguments/#interface-options

我用 docker run eventstore/eventstore -e EVENTSTORE_EXT_HTTP_PORT=52040 -p 52040:2113 测试过,可以通过端口 52040 访问接口。