首页 > 解决方案 > EventStore Docker 正在运行,但无法从主机访问 URL - 端口不起作用

问题描述

我第一次深入研究 Docker 容器的世界。我的主机环境是 VM 上的 Windows 10 Enterprise。我能够启动 docker 并使用 Linux 容器模式。Docker 引擎:v19.03.8

从 Evenstore 容器开始 -

 [https://github.com/EventStore/eventstore-docker][1]

我创建了一个撰写文件

version: '3.8'

services:

  eventstore:
    container_name: productservice-eventstore
    image: eventstore/eventstore
    ports:
        - 2113:2113
        - 1113:1113
    environment:
      - EVENTSTORE_EXT_HTTP_PORT=2113
      - EVENTSTORE_EXT_TCP_PORT=1113 
      - EVENTSTORE_DEV=true

我正在开发中运行 Eventstore 以避免 TLS 要求

容器启动并显示为在 docker 仪表板中运行,但我无法使用

http://localhost:2113/

enter code here
This site can’t be reachedlocalhost refused to connect.
Try:

Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED

从文件中我了解到 -P 2113:2113 确实进行了端口转发。我什至将外部端口更改为 8085,但仍然无法正常工作。

我需要帮助从主机 VM 访问 Eventstore ui。

问题2)我们可以通过compose文件(环境变量)为EventStore容器分配一个外部IP地址,可以直接在主机中使用而不是映射。

如果您需要日志中的信息,请告诉我

****** 编辑 1****

在我的回答中完成了撰写文件中的更改后,我能够让 UI 在 Edge 中工作,但出现一些错误

A) 微软边缘

  1. 在此处输入图像描述

2)在此处输入图像描述

B) 铬

  1. 在此处输入图像描述
  2. 在此处输入图像描述

从电源壳:

productservice-eventstore | ========================================================================================================
productservice-eventstore | DEVELOPMENT MODE IS ON. THIS MODE IS *NOT* INTENDED FOR PRODUCTION USE.
productservice-eventstore | WHEN IN DEVELOPMENT MODE EVENT STORE WILL
productservice-eventstore |  - NOT WRITE ANY DATA TO DISK.
productservice-eventstore |  - USE A SELF SIGNED CERTIFICATE.
productservice-eventstore | ========================================================================================================
productservice-eventstore |
productservice-eventstore | [    1, 1,13:43:36.155,INF]
productservice-eventstore | INTERFACES
productservice-eventstore | External TCP (Protobuf)
productservice-eventstore |     Enabled : True
productservice-eventstore |     Port    : 1113
productservice-eventstore | HTTP (AtomPub)
productservice-eventstore |     Enabled : True
productservice-eventstore |     Port    : 2113

尝试使用 edge 或 chrome 从主机访问时

productservice-eventstore | [    1,33,14:12:31.955,ERR] Client certificate validation error: "The certificate provided by the client failed validation with the following error(s): RemoteCertificateChainErrors (PartialChain)

**问题 3 **

可以下载自签名证书并将其添加到客户端信任模式吗?

标签: docker-composeportforwardingeventstoredb

解决方案


所以我一直在尝试在 google 中搜索不同的方式,并在 Eventstore Github 中发现了一个问题,这为我提供了很好的指导

https://github.com/EventStore/EventStore/issues/2547

Davide Guida 有类似的问题,Pieter Germishuys 的回答帮助了我

command: --dev --enable-external-tcp --ext-ip=0.0.0.0 --int-ip=0.0.0.0 --disable-external-tcp-tls

或者具体来说

--enable-external-tcp 

最终让我好好休息。

由于需要证书,问题没有完全解决,我期望在开发模式下运行时不需要证书


推荐阅读