Having issue to run the dock-compose example from the Opensearch documentation

Hi:

i try to run the “docker-compse up” with the example in the above link. But got the following errors

opensearch-node1         | ### To access your secured cluster open https://<hostname>:<HTTP port> and log in with admin/admin.
opensearch-node1         | ### (Ignore the SSL certificate warning because we installed self-signed demo certificates)
opensearch-node1         | Enabling OpenSearch Security Plugin
opensearch-dashboards    | {"type":"log","@timestamp":"2021-12-30T00:24:27Z","tags":["info","plugins-service"],"pid":1,"message":"Plugin \"visTypeXy\" is disabled."}
opensearch-dashboards    | {"type":"log","@timestamp":"2021-12-30T00:24:28Z","tags":["warning","config","deprecation"],"pid":1,"message":"\"cpu.cgroup.path.override\" is deprecated and has been replaced by \"ops.cGroupOverrides.cpuPath\""}
opensearch-dashboards    | {"type":"log","@timestamp":"2021-12-30T00:24:28Z","tags":["warning","config","deprecation"],"pid":1,"message":"\"cpuacct.cgroup.path.override\" is deprecated and has been replaced by \"ops.cGroupOverrides.cpuAcctPath\""}
opensearch-dashboards    | {"type":"log","@timestamp":"2021-12-30T00:24:28Z","tags":["info","plugins-system"],"pid":1,"message":"Setting up [44] plugins: [alertingDashboards,usageCollection,opensearchDashboardsUsageCollection,opensearchDashboardsLegacy,mapsLegacy,opensearchUiShared,share,legacyExport,embeddable,expressions,data,home,console,apmOss,management,advancedSettings,indexPatternManagement,savedObjects,reportsDashboards,indexManagementDashboards,securityDashboards,anomalyDetectionDashboards,dashboard,visualizations,tileMap,visTypeVega,visTypeTimeline,timeline,visTypeTable,visTypeMarkdown,regionMap,inputControlVis,ganttChartDashboards,visualize,queryWorkbenchDashboards,charts,visTypeVislib,visTypeTagcloud,visTypeTimeseries,visTypeMetric,observabilityDashboards,discover,savedObjectsManagement,bfetch]"}
opensearch-dashboards    | {"type":"log","@timestamp":"2021-12-30T00:24:29Z","tags":["info","savedobjects-service"],"pid":1,"message":"Waiting until all OpenSearch nodes are compatible with OpenSearch Dashboards before starting saved objects migrations..."}
opensearch-dashboards    | {"type":"log","@timestamp":"2021-12-30T00:24:29Z","tags":["error","opensearch","data"],"pid":1,"message":"[ConnectionError]: connect ECONNREFUSED 192.168.96.3:9200"}
opensearch-dashboards    | {"type":"log","@timestamp":"2021-12-30T00:24:29Z","tags":["error","savedobjects-service"],"pid":1,"message":"Unable to retrieve version information from OpenSearch nodes."}
opensearch-dashboards    | {"type":"log","@timestamp":"2021-12-30T00:24:32Z","tags":["error","opensearch","data"],"pid":1,"message":"[ConnectionError]: connect ECONNREFUSED 192.168.96.3:9200"}
opensearch-dashboards    | {"type":"log","@timestamp":"2021-12-30T00:24:34Z","tags":["error","opensearch","data"],"pid":1,"message":"[ConnectionError]: connect ECONNREFUSED 192.168.96.3:9200"}
opensearch-node1         | Killing performance analyzer process 104
opensearch-node1         | OpenSearch exited with code 137
opensearch-node1         | Performance analyzer exited with code 143
opensearch-node1         | ./opensearch-docker-entrypoint.sh: line 108:   103 Killed                  $OPENSEARCH_HOME/bin/opensearch "${opensearch_opts[@]}"
opensearch-node2         | Killing performance analyzer process 104
opensearch-node2         | OpenSearch exited with code 137
opensearch-node2         | Performance analyzer exited with code 143
opensearch-node2         | ./opensearch-docker-entrypoint.sh: line 108:   103 Killed                  $OPENSEARCH_HOME/bin/opensearch "${opensearch_opts[@]}"
opensearch-node2 exited with code 0
opensearch-node1 exited with code 0
opensearch-dashboards    | {"type":"log","@timestamp":"2021-12-30T00:25:07Z","tags":["error","opensearch","data"],"pid":1,"message":"[ConnectionError]: getaddrinfo ENOTFOUND opensearch-node1 opensearch-node1:9200"}
opensearch-dashboards    | {"type":"log","@timestamp":"2021-12-30T00:25:09Z","tags":["error","opensearch","data"],"pid":1,"message":"[ConnectionError]: getaddrinfo ENOTFOUND opensearch-node1 opensearch-node1:9200"}
opensearch-dashboards    | {"type":"log","@timestamp":"2021-12-30T00:25:11Z","tags":["error","opensearch","data"],"pid":1,"message":"[ConnectionError]: getaddrinfo ENOTFOUND opensearch-node1 opensearch-node1:9200"}
opensearch-dashboards    | {"type":"log","@timestamp":"2021-12-30T00:25:14Z","tags":["error","opensearch","data"],"pid":1,"message":"[ConnectionError]: getaddrinfo ENOTFOUND opensearch-node1 opensearch-node1:9200"}

if i check the opensearch note’s log .

[2021-12-30T00:28:19,773][WARN ][o.o.d.SeedHostsResolver  ] [opensearch-node1] failed to resolve host [opensearch-node2]

java.net.UnknownHostException: opensearch-node2

at java.net.InetAddress$CachedAddresses.get(InetAddress.java:800) ~[?:?]

at java.net.InetAddress.getAllByName0(InetAddress.java:1507) ~[?:?]

at java.net.InetAddress.getAllByName(InetAddress.java:1366) ~[?:?]

at java.net.InetAddress.getAllByName(InetAddress.java:1300) ~[?:?]

at org.opensearch.transport.TcpTransport.parse(TcpTransport.java:605) ~[opensearch-1.2.0.jar:1.2.0]

at org.opensearch.transport.TcpTransport.addressesFromString(TcpTransport.java:547) ~[opensearch-1.2.0.jar:1.2.0]

at org.opensearch.transport.TransportService.addressesFromString(TransportService.java:999) ~[opensearch-1.2.0.jar:1.2.0]

at org.opensearch.discovery.SeedHostsResolver.lambda$resolveHostsLists$0(SeedHostsResolver.java:177) ~[opensearch-1.2.0.jar:1.2.0]

at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]

at org.opensearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:733) ~[opensearch-1.2.0.jar:1.2.0]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) [?:?]

Could anyone give me a help on this issue ? why i am getting the “failed to resolve host”

[2021-12-30T00:28:19,773][WARN ][o.o.d.SeedHostsResolver  ] [opensearch-node1] failed to resolve host [opensearch-node2]

java.net.UnknownHostException: opensearch-node2

at java.net.InetAddress$CachedAddresses.get(InetAddress.java:800) ~[?:?]

at java.net.InetAddress.getAllByName0(InetAddress.java:1507) ~[?:?]

at java.net.InetAddress.getAllByName(InetAddress.java:1366) ~[?:?]

at java.net.InetAddress.getAllByName(InetAddress.java:1300) ~[?:?]

at org.opensearch.transport.TcpTransport.parse(TcpTransport.java:605) ~[opensearch-1.2.0.jar:1.2.0]

at org.opensearch.transport.TcpTransport.addressesFromString(TcpTransport.java:547) ~[opensearch-1.2.0.jar:1.2.0]

at org.opensearch.transport.TransportService.addressesFromString(TransportService.java:999) ~[opensearch-1.2.0.jar:1.2.0]

at org.opensearch.discovery.SeedHostsResolver.lambda$resolveHostsLists$0(SeedHostsResolver.java:177) ~[opensearch-1.2.0.jar:1.2.0]

at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]

at org.opensearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:733) ~[opensearch-1.2.0.jar:1.2.0]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) [?:?]


Cheers

OpenSearch Dashboards trying to connect to OpenSearch on your pc(192.168.96.3:9200) instead of inside docker container.
Try to replace this for opensearch-node1:
ports:
** - 9200:9200**
** - 9600:9600**
With this:
ports: **
** - “127.0.0.1:9200:9200” **
** - “127.0.0.1:9600:9600”

And for the opensearch-dashboards:
ports:
** - 5601:5601**
To this:
ports: **
** - “127.0.0.1:5601:5601”