Home Page not opening on localhost

HI,
I installed docker with VirtualBox on Windows 10 following the instructions.
Everything is ok except that the site does not open on localhost. I’ve spent 4 hours reinstalling, restarting checking again all settings but unsuccessfully.

This I have in Google Chrome:

This site can’t be reached

localhost refused to connect.

Try:

ERR_CONNECTION_REFUSED

docker within a VM on your host? you’re gonna want to make sure the vm is either bridged to your host’s NIC or use a host-only secondary nic with the primary nat’ed. If you wish to use the default NAT, you’ll need to do some port forwarding within virtualbox. The other options don’t require that, I avoid port forwarding if I can, it’s just added headache. The easiest is just using a bridged interface and connecting to whatever IP the VM gets from your router. The dual nic solution keeps the vm off your lan and local to your machine.

Localhost on any computer points to it’s internal network and only works for services running on it. To access devilbox within a VM, you’ll need to connect to it’s ip, not localhost.

Side note, you’ll need to add that VM’s ip address to your host’s dns server list to use the auto-dns functions else rely on the host’s /etc/hosts file or setup a wildcard dns entry on your lan’s dns server (if you have one).

Might be a wee bit complicated but isn’t too horrible. :slight_smile:

*VM = Virtual Machine
*NIC = Network Interface Card

Thank you! I understood the reason, why it doesn’t work.
I would be very glad if you would please write some concrete steps.
I switched in VirtualBox to Bridged Adapter. What are the next steps?

Ok, with a bridged adaptor you’ll want to obtain the IP address of the VM either by looking at it’s console screen before logging in (assuming server install, no GUI) or login and run ifconfig and look for the nic’s IP. It’s on the 2nd line next to inet. That is the IP you’ll use to connect from any other machine on the network. Now with servers, especially with something that may live for any length of time, you’ll want to set a static IP or “reserved IP” on your router. The instructions to do that depends on your router or you can lookup the docs for your VM OS. (You can still obtain the IP the same way if you used a NAT adaptor as well.)

Now, you should be able to at least see the status page of devilbox if you connect to the IP address in your web browser. To do the DNS thing, you can either manually configure your domain names you’d use for your projects in windows’ host file (c:\windows\system32\drivers\etc\hosts | open in notepad as admin) OR point your host’s primary dns server to the VM’s IP with the secondary to that of your router. That way, for as long as the VM is up, your pc will reach out to it for dns requests and all the dev stuff should work just fine.

Also, I noticed in the docs you could actually do something like this with the nic set to NAT for the VM…

Assuming the VM IP is 192.168.99.100 your forwards would be as follows:

From IP From port To IP To port
192.168.99.100 53 127.0.0.1 53
192.168.99.100 80 127.0.0.1 80
192.168.99.100 443 127.0.0.1 443

That would basically let you do the whole localhost thing as if it was local. I just never really bother doing port forwards in Virtualbox because I always wonder if and when the server IP will change and break things. :confused: ymmv

However you wish to do it, it should work. My setup runs on the local docker of my linux desktop so all I had to do was point my host’s resolver to the localhost. :thinking:

If things aren’t clear, feel free to ask. Might help to include some details just in case, whatever you feel may help. :slight_smile: Cheers.

Thanks for details! Unfortunately, I’ve spent again many hours with no positive results.
It is interesting tool but it so hard to make it work if you are not an expert in computers networking.
It would be nice to have some very short instructions of how to set it up, with different virtual machines such as VirtualBox, Hyper-V, Vmware.

Short instructions are like:

Docker + VirtualBox on WIndows

  1. Install VirtualBox - link
  2. Install Docker Toolbox - link
  3. Use this command to create a virtual machine - command
  4. Unzip DevilBox (link to package) in project folder.
  5. Start DevilBox - command
  6. Set Network Adapter settings - concrete settings (not theory about port forwarding etc…)
  7. Open DevilBox in browser with this IP: …

And after that it should work.
You see, it is not much to write in order to make if work for any ordinary user.
Ordinary user needs simple steps how to set up the system, how to start it and how to stop.

Detailed documentation is also good, it’s for those who want to get into details and who have time to read.

I appreciate much your product and work but It needs some usability improvement.

I’m not sure how else to explain it. There’s no one-shot way of doing things since it depends on your host OS, your network, and if you want others to access it or not. I feel like the developer did his best to provide instructions for the common systems. It’s up to the user to have some understanding of networking and the software in question.

The NAT thing sounds like the closest thing to exposing it’s services to your host. The bridged thing just makes it look like another computer on the lan. Still you’ll need to map the data directory in the VM to your host or setup ftp/samba and/or use ssh to access your project files. I’ve never really mapped a local folder to a linux vm but samba is reasonably simple to do (just need a few lines added to the config and a smb user created; you can find that at the ubuntu docs).

As an aside, it’s much easier on a linux host. :slight_smile: Install docker-ce, download devilbox somewhere, run docker-compose. point your dns to the localhost and network gateway. (one to note, the systemd-resolver needs to be disabled if you wish to use the devilbox dns server, a conflict occurs if you do not).

Might help to check this out;

and

I am sure that the developer did his best but I think that the users experience can help him make the product better and easier to use.
For me as a web developer - beginner it looks very hard to use, when I have to read tons of documentation, spend much time just to get it working. I have every day to read tons of documentation for each language add package that I am using in my work and when I have now to make additional efforts for a tool, which should work out of box, then I don’t feel that this tool brings happiness…

I am new in using virtualization, I forgot what I’ve learned long time ago about computer networking.
Some weeks ago I installed CentOS, Plesk on VirtualBox on WIndows 10 for tests and finding some solutions for our servers at the job. Even these things are new for me, I had no big problems.
Everything works with default settings.
Then I tried Vagrant on VirtualBox and I had no such problems.
As and example, look at scotch https://box.scotch.io/.

QUICK TUTORIAL

git clone [link to Github package]
cd my-project
vagrant up
Then visit: http://192.168.33.10

And you can work!
I think, it is possible to make Devil Box as simple as Scotch. It is almost one step from that.

I agree, the docs could be better. If I knew what would make it better, I’d consider editing and doing a pull request for the dev. It’s just, given the complexities of DevilBox and how it basically spins up a full stack of software with one single command, running it in virtualbox just adds a few extra steps that are easy to miss. I’m sorry you wasted time on it.

The hardest part I had on linux was getting the dns to work and ubuntu 18.04 made that a little harder than I expected. DNS can be finicky at times and I have a decent understanding of networking.

I’ll admit, even I have trouble finding usable instructions for running it on a windows host. :confused: The only relevant instructions I see that sound like they would make things work right in your case is the page about AutoDNS under Docker Toolbox. Perhaps a link to that from the Install page would help?

I installed Shopware 6 on Virtual Machine on VB. There is also 127.0.0.1 with NAT by default but it didn’t work for me. I switched to Bridged adapter and used the IP (192.168.51.103) which is shown when I hover with the mouse on small icon of network (2 small screens) in the bottom of VM terminal. By this IP I could get the home page of the project.
I tried them to apply the same approach for DevilBox. With Bridged Adapter I got the IP 192.168.51.104. opening it in browser I get the message:
“Forbidden. You don’t have permission to access / on this server”.

I have reinstalled few times and did everything I know in order to get the home page but unfortunately without success.
In documentation is written:

[localhost or 127.0.0.1 not found]

If you are using Docker Toolbox, the Devilbox intranet is not available on localhost or 127.0.0.1, but rather on the IP address of the Docker Toolbox machine.

By IP of Toolbox Machine (now it is 192.168.99.102) I get:

404 Not Found

nginx/1.14.2
So, it is not nothing, the server works but can not find the main page. Any Idea what could be the problem?

Hello!
Finally I make it working with Hyper-V and Docker Desktop.
It’s pity that now I can’t use Virtual Box. In order to use it is necessary to switch off Hyper-V and restart the computer.
The problem was in Docker-Toolbox. Even with Hyper-V Docker-Toolbox creates big problems.
For now, I am happy with this solution and it Hyper-V seems to work even faster then VirtualBox.