I'm trying to get gem hotwire-livereload working with my rails project. I'm trying to dockerise everything before I start to work. The hotwire-livereload gem uses redis to work.
Here is my Dockerfile
FROM ruby:3.2.2WORKDIR /appRUN apt-get update -qq && apt-get install -y \ nodejsCOPY Gemfile* ./RUN gem install bundler && bundle install --jobs 4 --retry 3COPY . .EXPOSE 3000CMD ["rails", "server", "-b", "0.0.0.0"]
And here is my docker-compose file
version: '3'services: app: build: context: . dockerfile: Dockerfile.dev ports: - '3000:3000' volumes: - .:/app depends_on: - db - redis env_file: - .env db: image: postgres environment: POSTGRES_USER: ${DATABASE_USERNAME} POSTGRES_PASSWORD: ${DATABASE_PASSWORD} ports: - '${DATABASE_PORT}:5432' volumes: - db-data:/var/lib/postgresql/data redis: image: redis ports: - '6379:6379' volumes: - redis-data:/datavolumes: db-data: redis-data:
When I try to run the docker, my app is starting, I can load the homepage, and then it's instantly crashing with the following error :Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) (Redis::CannotConnectError)
I tried differents docker-compose configurations but didn't manage to find one working