Мой gitlab-ci.yml выглядит так:
stage: functional_test
only:
- develop
- master
- merge_requests
services:
- redis:latest
- docker:18.06.2-dind
variables:
PHOTON_ENV: development
DOCKER_HOST: tcp://localhost:2375
REDIS_HOST: redis
REDIS_URL: redis://redis:6379/0
И мой python код для подключения Redis выглядит так:
self._redis = redis.Redis(host=_host,
port=_port,
db=_db,
decode_responses=True)
_host = 'redis'
_port = 6379
_db = 0
Однако каждый раз, когда я пытаюсь этот код, эта ошибка будет отображаться:
File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 772, in execute_command
403 connection = pool.get_connection(command_name, **options)
404 File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 994, in get_connection
405 connection.connect()
406 File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 497, in connect
407 raise ConnectionError(self._error_message(e))
408 redis.exceptions.ConnectionError: Error -2 connecting to redis:6379. Name or service not known.