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]
Problem solved. I was running artisan outside my php-fpm container :)
Most helpful comment
Problem solved. I was running artisan outside my php-fpm container :)