Hi Gary,

On 14.06.2025 13:00, Gary Gregory wrote:
> On Sat, Jun 14, 2025 at 3:09 AM Piotr P. Karwasz
> <pi...@mailing.copernik.eu> wrote:
>> I hope this helps you debug what is going on during the ElasticSearch
>> startup.
> 
> It appears that port 9200 is published in Docker, but it doesn't seem
> to be visible outside of Docker, maybe.
> 
> See https://gist.github.com/garydgregory/a83914942faa2d904bd16966559d07bc
> 
> Does that ring a bell?

Unfortunately, I don’t see any significant differences between your
startup logs and mine. On my setup, it ends with:

[INFO] DOCKER> [elasticsearch:8.17.3] "elasticsearch": Waited on tcp
port '[/172.19.0.2:9200]' 6521 ms

Whereas yours ends in a timeout:

[ERROR] DOCKER> [elasticsearch:8.17.3] "elasticsearch": Timeout after
60739 ms while waiting on tcp port '[/172.19.0.2:9200]'

As for the port binding, the Docker Maven Plugin is configured to bind
the container port 9200 to an ephemeral host port, assigning it to the
`elasticsearch.port` Maven property:

<ports>
  <!-- Binds an ephemeral port to the `elasticsearch.port` Maven
property. -->
  <port>localhost:elasticsearch.port:9200</port>
</ports>

This assumes that the Docker host is accessible via `localhost`, which
is valid on Linux, but may not hold on macOS.

You might want to try omitting the host name altogether:

<ports>
  <!-- Binds an ephemeral port to the `elasticsearch.port` Maven
property. -->
  <port>elasticsearch.port:9200</port>
</ports>

If that works, please submit a PR to fix the issue in
`log4j-layout-template-json` and `log4j-mongodb`.

Piotr

Reply via email to