Jake Lacey Jake Lacey - 20 days ago 5
Node.js Question

Linking Nodejs app container to elastic search container securely (Docker)

Elasitc search has no built in security so I need to handle it myself and the best way I thought of doing this to remove public access from it and only allow access from it through an API a node web application.

However I'm still able to access elastic search on port 0.0.0.0:9200, I basically only want the node application to be able to talk to elasticsearch.

version: "2"
services:
elasticsearch:
image: elasticsearch
ports:
- "9200:9200"
node-bot:
build: .
volumes:
- "./dist:/dist"
links:
- elasticsearch
ports:
- "3030:3005"
depends_on:
- "elasticsearch"


Hopefully that makes sense, thanks in advance.

Answer

Just remove ports from elasticsearch definition