Can someone help me with my Virtualbox?

I’m trying to get Discourse running on my home computer so I can test plugins etc. without breaking the main site (something I’ve been repeatedly guilty of).

I’ve done the following:

  • Installed Ubuntu 16 in a Virtualbox VM
  • Installed Discourse’s dependencies
  • Redis
  • Postgres
  • Ruby
  • Docker
  • Configured and installed Discourse (which runs inside a Docker Container)
  • Discourse is now running

The VM was connected via NAT while doing all this, but now I want to connect to it from a browser, which doesn’t seem to be working.

I’ve switched the VM’s network to Host-only.

blahblah adapter #3 shows up in windows and has an IP assigned (192.168.56.1). I can ping this IP from a windows CMD just fine.

Inside the VM, iptables has a route for http configured from “anywhere” to the Docker Container’s IP. This IP can happily be pinged (proves that the Docker Container is up and running).

So why don’t I get anything when I point my web browser at 192.168.56.1?

This is not familiar territory for me so be gentle :smiley:

What port is Discourse running on, if you are using http and it’s not on port 80, you have to specify the port number.

Also its not clear, but on OS X you are running VirtualBox which is one level of OS then Docker is in itself a virtual machine, and you have to patch through this…

It’s a mess honestly, way to abstract… Docker inception…

It’s definitely 80

The inception nature of this did not escape me :smiley:
(I ran into all sorts of issues with the “native” windows docker host so decided to go for the full-fat option)

Try using a bridged adapter.

Isn’t that for linking the VM up to a real hardware port? I do have a spare port, but no cable for it.

Besides, the connection itself is there. I can ping the VM. It’s just http requests that fall into the void.

(EDIT: Hang on a sec…)

hmmm. I can’t SSH into 192.168.56.1 with PuTTY. So maybe that connection’s not all there after all…

I am not completely clear whats going on because it is confusing but I think its a NAT/Port Forwarding issue…

In the image, under Settings > Network > Port Forwarding you need to forward the ports you want to use:

What I think is probably happening is that packets from your web browser or Putty are going no further than the VirtualBox software. Which explains why you can ping this virtual machine but not access anything within it.

In other words, the Web Browser / Putty cannot penetrate through the VirtualBox boundary in the above diagram.

This is where the inception issue is, it’s easy to forget how many levels of abstraction you are in:

  1. The Discourse Ruby server probably isn’t running on port 80 but some other port with a web server like Nginx in front of it that provides HTTP and HTTP on port 80 / 443.
    You can effectively ignore this level as its inside the Docker image.
  2. The Discourse Docker machine will have various ports open including 80 and 443 but it’s inside the Docker
    You appear to have opened the necessary ports in Docker at the Host level for you to access the pages, indeed you can test this from the command line inside the VirtualBox Ubuntu machine by using curl 127.0.0.1
  3. The VirtualBox network adapter won’t automatically forward requests to the Ubuntu OS and therefor down through the above layers.

In other words I think the request isn’t getting past the outer layer into the Docker host and then guest

1 Like

port forwarding is for NAT only
“Host-only” is a direct connection to a virtual network adapter in windows

further WTFs:

curl 172.17.0.1 gives me Connection refused

This from Chrome’s network inspector

IIS?! WHat are you doing here?

This is too much for a Saturday night :smiley:

Thanks for your help everyone, but I’m going to step away from this now. I could be watching an episode of high quality american TV instead :slight_smile:

Okay I am confused, can you try to be more clear where you are requesting things…

Requesting 172.17.0.1 from Windows won’t work ever, from inside the VirtualBox machine it should work.

Looking at your screen shot 192.168.56.1 is actually getting a 404 from Server: Microsoft-IIS 10.0 which is a web server on your Windows computer, check that IIS isn’t running in services.msc

I am not clear whether the 192.168.56.1 address is:

  1. Windows computer’s real network IP.
  2. The virtual IP of the Windows computer.
  3. The virtual IP of the VirtualBox computer.

That was some good TV :slight_smile:

Don’t worry, I understand how things are nested

No sign of IIS running in services.msc or task manager.

This is starting to feel like a problem too far to solve in 3rd person like this.

If you can get into the Docker’s command line you can:

a. Ask the OS what ports are open
b. Use curl to fetch the page.

It sounds like Docker isn’t configured correctly, Try using Kitematic.

Ah! There was me thinking kitematic was mac only :slight_smile:

Let’s see now…

Aaah, the host VM needs extra configuration, due to some parts of Discourse (postgres, nginx) living outside of the container. This means one-click installation in kitematic doesn’t work :frowning:

What a pile of __________

This turned out to be the solution :slight_smile:

Now I can thoroughly hose my own copy of discourse instead of SLMS’s :smiley: