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

**URL:** <https://discuss.elastic.co/t/help-setting-up-app-search-using-docker-with-xpack-enabled-error-cant-connect-to-elastic-backend/229035>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [April 21, 2020, 12:32pm UTC](https://discuss.elastic.co/t/help-setting-up-app-search-using-docker-with-xpack-enabled-error-cant-connect-to-elastic-backend/229035 "2020-04-21T12:32:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![varunharidas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varunharidas/32/63704_2.png) [@varunharidas](https://discuss.elastic.co/u/varunharidas)\
**Post date:** [April 21, 2020, 12:32pm UTC](https://discuss.elastic.co/t/help-setting-up-app-search-using-docker-with-xpack-enabled-error-cant-connect-to-elastic-backend/229035/1 "2020-04-21T12:32:09Z")

</div>

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

```auto
   `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

```

---

<div class="post-metadata">

**Author:** ![varunharidas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varunharidas/32/63704_2.png) [@varunharidas](https://discuss.elastic.co/u/varunharidas)\
**Post date:** [April 22, 2020, 12:14pm UTC](https://discuss.elastic.co/t/help-setting-up-app-search-using-docker-with-xpack-enabled-error-cant-connect-to-elastic-backend/229035/2 "2020-04-22T12:14:50Z")

</div>

Anyone?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 20, 2020, 12:14pm UTC](https://discuss.elastic.co/t/help-setting-up-app-search-using-docker-with-xpack-enabled-error-cant-connect-to-elastic-backend/229035/3 "2020-05-20T12:14:59Z")

</div>

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