Redis Exception and Connection Refused Error Occurred

123 views Asked by At

I have a Laravel project that is running by docker-compose. There's a docker-compose.yml to run the redis and php services. Here is the docker-compose file:

version: '3.8'
services:
  appetit-php:
    build:
     context: ./docker-file/php
     dockerfile: Dockerfile
   container_name: appetit-php
   restart: always
   volumes:
     - ./services/legacy:/var/www/
     - ./docker-data/config/php/php.ini:/usr/local/etc/php/php.ini
     - ./docker-data/config/php/supervisor/conf.d/:/etc/supervisor/conf.d/
   working_dir: /var/www
   networks:
     - appetit-network

 appetit-redis:
  image: "redis"
  container_name: appetit-redis
  restart: always
  volumes:
    - ./docker-data/data/redis/:/data/
  ports:
    - "6378:6379"
  networks:
    - appetit-network
  

networks:
  appetit-network:
    driver: bridge

There's a permission error that I don't know how to fix, when I ran php artisan horizon everything was fine, but I got an error when I ran: sudo php artisan horizon. The error is:

 RedisException 

 Connection refused
 at vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:161

Also, when I execute whoami I get the root as a result. How can I solve this?

0

There are 0 answers