[ConnectionError]: connect ECONNREFUSED 172.29.0.2:9200" (Opensearch + Dashboards + Docker)

Hi All,

I’m attempting to set up a working opensearch + dashboards on inside docker containers on a DigitalOcean virtual machine (running ubuntu 20.04).

With the below docker-compose.yml file the containers load properly and I’m able to connect to the opensearch containers from the NGINX container, however, when I docker exec -it opensearch-dashboards sh into the container and attempt to issue the test cURL commands as specified in the installation docs I receive an ECONNREFUSED error.

Is there a terribly obvious mistake in my configuration?

networks:
  opensearch-net: {}
services:
  opensearch-dashboards:
    container_name: opensearch-dashboards
    environment:
      OPENSEARCH_HOSTS: "[\"https://opensearch-node1:9200\",\"https://opensearch-node2:9200\"]"
    expose:
      - '5601'
    image: opensearchproject/opensearch-dashboards:2.1.0
    networks:
      opensearch-net:
        aliases:
          - com-withbanner-opensearch-dashboard
    ports:
      - "5601:5601"
    volumes: []
  opensearch-node1:
    container_name: opensearch-node1
    environment:
      - cluster.name=opensearch-cluster
      - node.name=opensearch-node1
      - "discovery.seed_hosts=opensearch-node1,opensearch-node2"
      - "cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2"
      - bootstrap.memory_lock=true
      - OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m
      - network.host=0.0.0.0
    image: opensearchproject/opensearch:2.1.0
    networks:
      - opensearch-net
    ports:
      - "9200:9200"
      - "9600:9600"
    ulimits:
      memlock:
        hard: -1
        soft: -1
      nofile:
        hard: 65536
        soft: 65536
    volumes:
      - opensearch-data1:/usr/share/opensearch/data
  opensearch-node2:
    container_name: opensearch-node2
    environment:
      - cluster.name=opensearch-cluster
      - node.name=opensearch-node2
      - "discovery.seed_hosts=opensearch-node1,opensearch-node2"
      - "cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2"
      - bootstrap.memory_lock=true
      - OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m
      - network.host=0.0.0.0
    image: opensearchproject/opensearch:2.1.0
    networks:
      - opensearch-net
    ulimits:
      memlock:
        hard: -1
        soft: -1
      nofile:
        hard: 65536
        soft: 65536
    volumes:
      - opensearch-data2:/usr/share/opensearch/data
  proxy:
    build: "../nginx"
    networks:
      - opensearch-net
    ports:
      - "80:80"
      - "443:443"
version: '3.9'
volumes:
  opensearch-data1: {}
  opensearch-data2: {}

I had the same problem, but my Docker gave an error on the java client :Timeout connecting to [/172.20.0.3:9200]. Did you solve the problem