Open e212156822000 opened 6 years ago
I got a solution for docker + rails + elasticsearch + searchkick.
Here is my content of docker-compose.yml
:
version: '3'
services:
db:
image: postgres
volumes:
- .:/ruby_practice/db
web:
build: .
command: rails server -p 5000 -b '0.0.0.0'
ports:
- "5000:5000"
volumes:
- .:/ruby_practice
links:
- db
- elasticsearch
environment:
- ELASTICSEARCH_URL=http://elasticsearch:9200
elasticsearch:
image: elasticsearch
ports:
- "9200:9200"
environment:
- bootstrap.memory_lock=true
- xpack.security.enabled=false
- network.host=0.0.0.0
- cluster.name=elasticsearch
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "http.host=0.0.0.0"
- "transport.host=127.0.0.1"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /usr/share/elasticsearch/data
大大您好,我在您的網誌看到了您用Docker部署elasticsearch + searchkick + rails,想問您是否保留先前的
docker-compose.yml
file,想要參考看看,我目前裝起來一直噴Failed to open TCP connection to localhost:9200
這個錯,也照網誌的說法用network把web(rails)、db(pg)、elasticsearch連起來了,但無濟於事。目前curl 172.0.0.1:9200都是正常的。 以下是我的docker-compose內容:
非常謝謝你看完!