我正在運行「elasticsearch」容器。我可以捲曲容器並獲得結果,但是當我嘗試與我的「web」容器內的容器進行通信時,它會拒絕連接。碼頭集裝箱之間的通信故障
docker-compose up
curl localhost:9200 // works.
curl docker-compose run web curl localhost:9200 // connection refused.
docker-compose.yml
version: '2'
services:
web:
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/src
ports:
- "5000:5000"
depends_on:
- elasticsearch
elasticsearch:
image: elasticsearch:5.1.2
ports:
- "9200:9200"
Dockerfile
FROM python:3.5
ADD . /src
WORKDIR /src
RUN pip install -r requirements.txt
CMD python project/wsgi.py
你想添加'Dockerfile'嗎? – Rao
@Rao我加了。 –