Application running in docker can't connect with elasticsearch docker

前端 未结 1 742
逝去的感伤
逝去的感伤 2021-01-15 17:55

I am new to docker and having a simple DW(dropwizard) application that connects to elasticsearch, Which is already running in docker using the docker-compose.yml, which has

相关标签:
1条回答
  • 2021-01-15 18:32

    Two ways to solve this: First is to check what network docker-compose created for your elasticsearch setting (docker network ls) and then run your DW app with

    docker run --network=<name of network> ...

    Second way is to create a network docker network create elastic and use it as external network in your docker compose file as well as in your docker run command for the DW app.

    Docker compose file could then look like

    ...
    services:
      elasticsearch:
         networks:
           elastic:
    ...
    networks:
        elastic:
            external: true
    
    0 讨论(0)
提交回复
热议问题