rails + docker + sidekiq + Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)

前端 未结 2 2136
情深已故
情深已故 2021-02-14 05:18

I am getting this error while running my rails app with docker and docker-compose Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)

Please find my Docker

相关标签:
2条回答
  • 2021-02-14 05:36

    Links are not required to enable services to communicate - by default, any service can reach any other service at that service’s name.

    According to your docker-compose.yaml file you can access you redis container on 127.0.0.1:6379 only from host machine.

    Containers communicate with each other in their network, so you can access your redis container on redis:6379 from rails app container.

    0 讨论(0)
  • 2021-02-14 05:47

    I use a docker-compose and i add in .env file

    REDIS_URL=redis://redis:6379/0
    
    0 讨论(0)
提交回复
热议问题