对不起,但是我是Redis和Docker的新手,我陷入困境。
我想使用docker-compose将redis连接到我的本地主机。当我使用docker-compose我的网站时,我的redis显示它们处于打开状态,但是当我尝试使curl -L http://localhost:8081/ping进行测试时,我收到此消息“ curl:(56)Recv failure:”
我试图更改docker-compose.yaml,但无法正常工作
docker-compose:
version: '3'
services:
redis:
image: "redis:latest"
ports:
- "6379:6379"
web:
build: .
ports:
- "8081:6379"
environment:
REDIS_HOST: 0.0.0.0
REDIS_PORT: 6379
REDIS_PASSWORD: ""
depends_on:
- redis
Dockerfile
FROM python:3-onbuild
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
CMD ["python", "main.py"]
我的预期结果是:
卷曲-L http://localhost:8081/ping
pong
卷曲-L http://localhost:8081/redis-status
{“ redis_connectivity”:“确定”}