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
For Rails 5.1 the following line in config/boot.rb will do the trick:
ENV['PORT'] = '8081'
Link to the source.