Docker Toolbox and the Devilbox
orphan
Docker Toolbox and the Devilbox
Docker Toolbox is a legacy solution to bring Docker to systems which don’t natively support Docker. This is achieved by starting a virtualized Linux instance (e.g.: inside VirtualBox) and have Docker run inside this machine.
You don’t have to take care about setting up the virtual machine, this is done automatically with the provided setup file (Windows and MacOS).
However, there are a few stumbling blocks you need to pay attention to in order to use the Devilbox at its full potential.
Docker Toolbox
install docker toolbox wininstall docker toolbox macinstall docker toolbox mac native vs toolboxext link docker machine
Devilbox listening address configuration
First thing you need to make sure is that the LOCAL_LISTEN_ADDR
variable from your .env file is empty. When it is empty all services
bind to all IP addresses inside the virtual machine and thus being able
to be seen from outside the virtual machine (your host operating
system).
You can verifiy that the variable is actually empty by checking your
.env file:
host> grep ^LOCAL_LISTEN_ADDR .env
LOCAL_LISTEN_ADDR=[!IMPORTANT] The variable should exist, but there should not be any value after the equal sign.
env-file
Find the Docker Toolbox IP address
The Devilbox intranet will not be available under 127.0.0.1 or
localhost as it does not run on your host operating system, but on a
virtualized Linux machine which has a different IP address.
To find out the IP address on which Docker Toolbox is running you have
to use the docker-machine command. Open a terminal and type the
following:
host> docker-machine ip default192.168.99.100The above example outputs 192.168.99.100, but this might be different
on your machine.
In this example I would then paste http://192.168.99.100 in the web
browsers address bar to reach the Devilbox intranet.
howto-open-terminal-on-machowto-open-terminal-on-winhowto-find-docker-toolbox-ip-address
Project DNS record pitfalls
When creating manual DNS records per project, you have to keep in mind
that you cannot use 127.0.0.1 for the IP address part. You have to use
the IP address of the Docker Toolbox virtual machine as was shown in the
above example.
Assuming the Docker Toolbox IP address is: 192.168.99.100, you have to
create DNS records as follows:
192.168.99.100 project.lochowto-add-project-hosts-entry-on-machowto-add-project-hosts-entry-on-winhowto-find-docker-toolbox-ip-address
Auto-DNS via port forwarding
In order to make Auto-DNS for projects work as it does for native Docker implementations you will have to do some prior configuration.
How does Auto-DNS work?
Auto-DNS is a catch-all DNS resolver for your chosen env-tld-suffix
that will redirect any domain to 127.0.0.1. Unfortunately Docker
Toolbox does not listen on that IP address.
How to fix it for Docker Toolbox
To overcome this problem, you will have to create three port forwards on
your host operating system from the Docker machine IP address for DNS
(port 53), http (port 80) and https (port 443) to 127.0.0.1 on
your host os.
Assuming the Docker Toolbox IP address is 192.168.99.100 the three
port forwards must 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 |
howto-find-docker-toolbox-ip-addresshowto-ssh-port-forward-on-docker-toolbox-from-hostsetup-auto-dns
Mount shared folders
Docker Toolbox will automatically set up a shared directory between your host operating system and the virtual Linux machine. Only files and directories within this shared directory can be used to be mounted into Docker container. If you plan to mount files or directories outside of this default path you have to create a new shared directory as described below.
MacOS
When you want to have your projects reside not somewhere in the /Users
directory, ensure you have read, understood and applied the following:
“By default, Toolbox only has access to the
/Usersdirectory and mounts it into the VMs at/Users. If your project lives elsewhere or needs access to other directories on the host filesystem, you can add them.”
install docker toolbox mac shared directory
Windows
When you want to have your projects reside not somewhere in the
C:\Users directory, ensure you have read, understood and applied the
following:
“By default, Toolbox only has access to the
C:\Usersdirectory and mounts it into the VMs at/c/Users. If your project lives elsewhere or needs access to other directories on the host filesystem, you can add them, using the VirtualBox UI.”
Symlinks
VirtualBox might not allow symlinks by default on other directories.
This can however be fixed manually. Let’s assume You’ve added a shared
folder D:/ to VirtualBox on d, you will then need to manually allow
symlinks via VboxManage command:
First check if symlinks are disabled
host> VboxManage getextradata default enumerate
Key: VBoxInternal2/SharedFoldersEnableSymlinksCreate/d, Value: 0The Value: 0 indicates that symlinks are not allowed. To enable it, do
the folllowing:
VBoxManage setextradata default VBoxInternal2/SharedFoldersEnableSymlinksCreate/d 1Now check again
host> VboxManage getextradata default enumerate
Key: VBoxInternal2/SharedFoldersEnableSymlinksCreate/d, Value: 1The Value: 1 now indicates that symlinks are allowed.
*
install docker toolbox win shared directory
* https://github.com/cytopia/devilbox/issues/479 *
https://www.virtualbox.org/ticket/10085