0
0

Redis::CannotConnectError (Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)):の解消方法

Posted at

docker環境において、localhost:xxxx/sidekiqへアクセス出来なかった時の対処法

error
Redis::CannotConnectError (Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)):

docker-compose.ymlへ追記

envを追記

docker-compose.yml
  sidekiq:
    build: .
    environment: # ここから下
      RAILS_ENV: development
      REDIS_URL: redis://redis:6379

起動時の設定を追加する

以下を作成

config/initializers/sidekiq.rb
redis_config = { url: 'redis://redis:6379/0' }

Sidekiq.configure_server do |config|
  config.redis = redis_config
end

Sidekiq.configure_client do |config|
  config.redis = redis_config
end
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0