Help setting up App-search using Docker with xpack enabled - Error can't connect to elastic backend

Hey, I can successfully run app-search with my configuration without pack security enabled, however, I need security as I'm querying the search API from my frontend and the hsotname is public.

I can verify my elastic is running fine by entering the bash of my container and running curl -u username:pass http://localhost:9200

But the app search returns an error saying Failed to connect to Elasticsearch backend. Make sure it is running.
, also I cannot do the curl from the app search container bash, I think that container doesn't have access to the elastic node.

Here is my docker-compose file

   `version: '2'

    services:
      elasticsearch:
        image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
        environment:
        - "node.name=es-node"
        - "discovery.type=single-node"
        - "cluster.name=app-search-docker-cluster"
        - "bootstrap.memory_lock=true"
        - ELASTICSEARCH_PASSWORD=Mypassword
        - ELASTICSEARCH_USERNAME=elastic
        - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
        ulimits:
          memlock:
            soft: -1
           hard: -1
    volumes:
        - ./elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
        hostname: elasticsearch


      appsearch:
        image: docker.elastic.co/app-search/app-search:7.6.2
        environment:
        - elasticsearch.host=http://elasticsearch:9200 ## also tried localhost
        - "allow_es_settings_modification=true"
        - "app_search.external_url: https://elastic.domain.com"
        - "JAVA_OPTS=-Xms2g -Xmx2g"
        - "app_search.auth.source: standard"
        - "elasticsearch.username: elastic"
        - "elasticsearch.password: Mypassword"
        ports:
        - 3002:3002

Anyone?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.