This docker-compose.yml seems to work OK:
version: '3'
services:
web:
image: web-app
command: bundle exec rackup
ports:
- "9292:9292"
links:
- redis
redis:
image: redis
Command:
docker build -t web-app .; docker-compose up
The Web App is expecting a REDIS_URL config. Web App Dockerfile:
ENV REDIS_URL redis:6379
It seems that the Web App cannot connect to the Redis:
Redis::CannotConnectError - Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED):
So, what is the Redis URL for the Web App?
Do I need to expose the Redis port (6379)?
EDIT:
Thanks to @Andy Shinn, I see the redis url should be redis://6379.
Now I get Errno::EINVAL - Invalid argument - connect(2) for 0.0.24.235:6379. This may have to do with Redis v 3.2.8. I'll try another version and see if it works.
EDIT #2:
3.2.8 works fine with the app on my local machine, so that is not the issue.
webafter a bit -> that way you know thatredishas been started.webservice is trying to connect to redis at the local IP (127.0.0.1) and not theREDIS_URLwhich should be theredisDNS name from the link. What kind of application is this? Is it designed to use theREDIS_URL? It would be helpful to post a bit more about the application (Dockerfile, how it uses theREDIS_URL, etc).REDIS_URL. It's a Sinatra app. Other configs work, and production has aREDIS_URL.0.0.24.235the IP it's attempting to reach now, or a copy/paste error?