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
- Add the following code under docker-compose.yml file
environment: REDIS_PORT: 6379
I tried this method but it didn’t work. I don’t know why. I’m trying to explain it here.
- Directly modify. env configuration file
REDIS_HOST=dnmp_redis_1:6379, this method is effective
Finally, put a reference linkLink description