Ruby Ruby on Rails Système 2017 | 02 | 09

Rails 5 web console and Docker

If you use Rails 5 along docker for your development environment you may have seen something like this within your logs :

Cannot render console from 172.17.0.x! Allowed networks:, ::1,

To allow your current docker network to access the web console you should add some discovery logic within your config/environments/development.rb file.

require 'socket'
require 'ipaddr'

config.web_console.whitelisted_ips = Socket.ip_address_list.reduce([]) do |res, addrinfo|
  addrinfo.ipv4? ? res << : res