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.
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.
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. 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.
If things aren’t clear, feel free to ask. Might help to include some details just in case, whatever you feel may help. 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
Install VirtualBox - link
Install Docker Toolbox - link
Use this command to create a virtual machine - command
Unzip DevilBox (link to package) in project folder.
Start DevilBox - command
Set Network Adapter settings - concrete settings (not theory about port forwarding etc…)
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. 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).
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. 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.
I have the same issue as you are. Also stuck trying to find a solution.
Installed devilbox inside “C:\Users” to ensure my virtual box has shared access
Specified user id and group in .env file
I went even further, upgraded Windows 8 to Windows 10, because of this issue, than downgraded back to 8.
Reinstalled Docker-toolbox a couple of times
Tried disabling Windows Firewall completely
Went to VistualBox -> Settings -> Network -> Adapter 1 -> Attached to = and switched from “NAT” to “Bridget Adapter”.
But still the same.
When I open “localhost” or “127.0.0.1” I get the same message as you are. Can you please share your solution? Thank you.
# This site can’t be reached
**localhost** refused to connect.
Try:
* Checking the connection
* [Checking the proxy and the firewall](chrome-error://chromewebdata/#buttons)
ERR_CONNECTION_REFUSED
This time I used default devilbox “env-example” file (no user id or group id are needed on Windows 8)
Also, I dont believe this issue was related to Windows Firewall. However I added docker.exe and docker composer manually to my firewall rules.
The main issue is I used wrong IP address to access devilbox intranet. Those who are using “docker-toolbox”, must use docker machine IP address instead of 127.0.0.1 or localhost. You will see your IP address after you run “Docker Quickstart Terminal” (see attached screenshot). The default IP address is: 192.168.99.100
When I followed the official devilbox installation manual, this info was not so visible (at least to me). So, at first I found my answer in the troubleshooting section:
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.
That sounds very interesting. Indeed, the speed of websites installed on docker-toolbox + devilbox is terrible.
I have two questions if you don’t mind:
1/ How do you access devilbox intranet from Windows? Is it accessible via the same IP 127.0.0.1 or localhost, even though its located on Ubuntu?
2/ I assume all virtual hosts must be created on Ubuntu as well. How do you access them from Windows?
I can access DevilBox from Windows by 127.0.0.1 or by http://localhost/.
On Ubuntu I don’t create anything. In order to get access from Windows is necessary to add the project domain to Hosts file which is here:
c:\Windows\System32\drivers\etc.
Example:
The project on DevilBox is in the folder “wp-dev”.
The domain name is http://wp-dev.loc/
In Hosts file is necessary to add:
No Host DNS record found. Add the following to /etc/hosts : 127.0.0.1 mytest.loc
So, even though the error message mentions “/etc/hosts”, not Windows hosts location, I followed your instructions and:
Added 127.0.0.1 mytest.loc into my C:\Windows\System32\Drivers\etc\hosts file
Here is what I have in C:\Windows\System32\Drivers\etc\hosts file:
127.0.0.1 mytest.loc
After I restarted Windows & Ubuntu, WSL automatically synchronized Windows hosts with Ubuntu /etc/hosts file and both files now have “127.0.0.1 mytest.loc” line.
Here is how my Ubuntu hosts file “/etc/hosts” looks:
This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
I had same issue in the beginning, but it was long time ago and I don’t remember precisely what I did.
Probably you have to do some settings in .env file as well.
For instance I have such setting as:
LOCAL_LISTEN_ADDR=127.0.0.1:
I could send you my .env file to an email address if you want. Here I tried but could not publish it.
Amida, thanks a lot!
Your suggestion worked!
I updated this line in my .env file:
LOCAL_LISTEN_ADDR=127.0.0.1:
Now everything works great.
Anyhow, I just discovered another WSL2 setup and wanted to share it with you.
In this article: WSL 2 + Docker Edge- Tech Preview: Native Linux containers w/o emulation | by Sean Dearnaley | The Startup | Medium the author installed Docker Edge on Windows 10 and uses Ubuntu only as a shell to access docker on Windows. His website files are probably located on Windows too and accessible from Ubuntu via mount points (e.g. cd /mnt/c)
Is there any performance difference when running docker in Windows vs Linux? I assume that Windows version should eat more resources and run slower.
Let me know what do you think.
P.S. I plan to write an article about Magento on Win 10 with WSL. Can I mention you in it? Is that your website: nickymeuleman.netlify.app ?