Framework: Redis exception when running cache:clear

Created on 19 Feb 2018  路  1Comment  路  Source: laravel/framework

  • Laravel Version: 5.6
  • PHP Version: 7.1.13
  • Predis: 1.1.1

When running artisan cache:clear command the following error is thrown:

In AbstractConnection.php line 155:

  php_network_getaddresses: getaddrinfo failed: No such host is known. [tcp://redis:6379]

I'm running Laravel in php-fpm Docker container and my redis config is this:

version: "3.1"
services:
  redis:
      image: redis:alpine
      container_name: web-redis

My .env config is:

CACHE_DRIVER=redis
...
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379

If I set REDIST_HOST=localhost it works just fine on CLI but then it won't work on web:

 Predis \ Connection \ ConnectionException (99)
Cannot assign requested address [tcp://localhost:6379]

Most helpful comment

Problem solved. I was running artisan outside my php-fpm container :)

>All comments

Problem solved. I was running artisan outside my php-fpm container :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

progmars picture progmars  路  3Comments

lzp819739483 picture lzp819739483  路  3Comments

klimentLambevski picture klimentLambevski  路  3Comments

shopblocks picture shopblocks  路  3Comments

YannPl picture YannPl  路  3Comments