lieroes
lieroes

Reputation: 694

Can't access redis from symfony application via docker

I received the next error: Cannot assign requested address [tcp://localhost:6379]. Please help me to solve this issue. Thank you!

docker-compose.yaml

version: "3.1"
services:

redis:
  image: redis:alpine
  container_name: ficbook-redis
  ports:
    - "6379:6379"
  volumes:
    - ./data/redis:/data/redis

elasticsearch:
  image: elasticsearch:5.4-alpine
  container_name: ficbook-elasticsearch

webserver:
  image: nginx:alpine
  container_name: ficbook-webserver
  working_dir: /application
  volumes:
      - ./application:/application
      - ./phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
  ports:
    - "80:80"
  links:
    - redis
    - php-fpm
    - elasticsearch

php-fpm:
  build: phpdocker/php-fpm
  container_name: ficbook-php-fpm
  working_dir: /application
  volumes:
    - ./application:/application
    - ./phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/7.2/fpm/conf.d/99-overrides.ini
  links:
    - redis

app/config/parameters.yml

# This file is auto-generated during the composer install
parameters:
    redis_dsn: 'redis://localhost'
    redis_session_dsn: 'redis://localhost/2'
    redis_token_dsn: 'redis://localhost/3'

Upvotes: 3

Views: 3102

Answers (1)

Fabien Papet
Fabien Papet

Reputation: 2319

Try only redis://redis you should be able to access it

Upvotes: 10

Related Questions