Docker and laravel’s Question on redis

  docker, question

Run the laravel framework in the docker environment and use the predis extension. Error reporting when linking redis:

At last, docker’s system environment variable covered laravel’s. env variable.
There are two solutions

  1. Add the following code under docker-compose.yml file

I tried this method but it didn’t work. I don’t know why. I’m trying to explain it here.

  1. Directly modify. env configuration fileREDIS_HOST=dnmp_redis_1:6379, this method is effective

Finally, put a reference linkLink description