"Failed to parse address" on Redis connection - Laravel + Predis + Laradock

Posted 1 year ago by getupkid

Hi everyone, I'm trying to setup Redis with a fresh laravel application. I set it as the driver for both caching and sessions.

However, I am getting this exception thrown:

 Predis \ Connection \ ConnectionException
 Failed to parse address "redis:tcp://172.17.0.13:6379" [tcp://redis:tcp://172.17.0.13:6379]

It sounds like something to do with the way the address is written but can't figure it out.

Here are some relevant details:

config/database.php

      'redis' => [

         'client' => 'predis',

         'cluster' => false,

              'default' => [
                  'host' => env('REDIS_HOST', 'redis'),
             'password' => env('REDIS_PASSWORD', null),
             'port' => env('REDIS_PORT', 6379),
             'database' => 0,
         ],

     ]

config/session.php

      'driver' => env('SESSION_DRIVER', 'redis'),
      'connection' => 'default',

config/cache.php

      'default' => env('CACHE_DRIVER', 'redis'),

 'stores' => [

         'redis' => [
             'driver' => 'redis',
             'connection' => 'default',
         ],

     ],

docker-compose.yml

      redis:
            build: ./laradock/redis
            volumes:
              - ./storage/data/redis:/data
            expose:
             - "6379"
            network_mode: bridge

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.