Docker and laravel's questions about redis

run the laravel framework in the docker environment, using the predis extension. In the link redis Times made an error:

Mar.05,2021

when it was finally found that the system environment variable of docker overrides the .env variable of laravel.
there are two

solutions.
  1. add the following code under the docker-compose.yml file
environment:
      REDIS_PORT: 6379

I've tried this method, but it didn't work. I don't know why. I'd like to ask for an explanation.

  1. modify the .env configuration file directly REDIS_HOST=dnmp_redis_1:6379 . This method is tested to be valid

finally put a reference link link description

Menu