I have seen this and several others question, but their problems are not similar to mine.
I have added the following code to the config/boot.rb , to run
config/boot.rb
In Rails 5.2
Rails 5.2
in config/puma.rb I added this code.
config/puma.rb
#port ENV.fetch("PORT") { 3000 } bind 'tcp://0.0.0.0:3001'
And it works!