Vagrant-Docker Port Forwarding Issue

Hey everyone,

I’m currently working on a task involving running my Rails (Movie) app through Vagrant using the Docker provider. Since I’m using a MacBook Air M1, installing VirtualBox is not feasible, so I opted for Docker. However, I’m encountering a port forwarding issue where connecting to localhost:3000 is not working.

Here are the steps I’ve taken:

  1. Initiated Vagrant with vagrant init tknerr/baseimage-ubuntu-18.04.
  2. Executed vagrant up --provider docker.
  3. Accessed Vagrant through vagrant ssh.
  4. Updated packages with sudo apt-get update.
  5. Installed Nginx, Ruby using rbenv, and PostgreSQL.
  6. Cloned a movie repository.
  7. Ran bundle install and bundle update for required gems.
  8. Successfully set up the container with a running PostgreSQL instance.

My Vagrant file is configured with: "forwarded_port", guest: 3000, host: 3000

When I run curl localhost:80, I can access the Rails app index page. However, attempting to connect via a browser using port 3000 is unsuccessful. I’ve also tried ports 80 and 8080, adjusting the Vagrant file accordingly, and executing vagrant reload. Unfortunately, the issue persists.

I would greatly appreciate your guidance in resolving this port forwarding problem. Your quick response would be invaluable. Thanks