在docker中构建并运行容器后,我收到了此错误。
我收到的错误消息:
ConnectionError: Error 99 connecting to localhost:6379. Address not available.
redis_init.py
import redis
redis_client = redis.StrictRedis()
docker-compose.yml
version: '2'
services:
data:
image: postgres:9-alpine
environment:
POSTGRES_PASSWORD: 'test'
volumes:
- /var/lib/postgresql
command: echo true
links:
- redis
privileged: true
postgres:
image: postgres:9-alpine
environment:
POSTGRES_PASSWORD: 'test'
volumes_from:
- data
ports:
- '5432:5432'
web:
build: .
environment:
OPENSHIFT_PYTHON_IP: '0.0.0.0'
OPENSHIFT_PYTHON_PORT: '5000'
FFMPEG_PATH: 'ffmpeg/ffmpeg'
OPENSHIFT_POSTGRESQL_DB_HOST: postgres
OPENSHIFT_POSTGRESQL_DB_PORT: '5432'
OPENSHIFT_POSTGRESQL_DB_USERNAME: postgres
OPENSHIFT_POSTGRESQL_DB_PASSWORD: test
POSTGRESQL_DB_NAME: dbproject1
links:
- postgres:postgres
ports:
- '80:5000'
redis:
image: redis
command: redis-server /usr/local/etc/redis/redis.conf
volumes:
- ./redis/data:/data
- ./redis/redis.conf:/usr/local/etc/redis/redis.conf
ports:
- "6379"
privileged: true
我预计此问题是由于docker.compose.yml或redis_conf文件而发生的。感谢您对此问题的帮助。
谢谢。