Attention

You can now create your own custom flavour of PHP-FPM Community images and easily add them to the Devilbox: PHP-FPM Community

1. Setup Auto DNS

If you don’t want to add host records manually for every project, you can also use the bundled DNS server and use it’s DNS catch-all feature to have all DNS records automatically available.

Important

By default, the DNS server is set to listen on 1053 to avoid port collisions during startup. You need to change it to 53 in .env via HOST_PORT_BIND.

Table of Contents

1.1. Native Docker

The webserver as well as the DNS server must be available on 127.0.0.1 or on all interfaces on 0.0.0.0. Additionally the DNS server port must be set to 53 (it is not by default).

1.1.1. Prerequisites

First ensure that LOCAL_LISTEN_ADDR is either empty or listening on 127.0.0.1.

.env
host> cd path/to/devilbox
host> vi .env
LOCAL_LISTEN_ADDR=

Then you need to ensure that HOST_PORT_BIND is set to 53.

.env
host> cd path/to/devilbox
host> vi .env
HOST_PORT_BIND=53

Before starting up the Devilbox, ensure that port 53 is not already used.

host> netstat -an | grep -E 'LISTEN\s*$'
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:43477         0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:50267         0.0.0.0:*               LISTEN

If you see port 53 already being used as in the above example, ensure to stop any DNS resolver, otherwise it does not work.

The output should look like this (It is only important that there is no :53.

host> netstat -an | grep -E 'LISTEN\s*$'
tcp        0      0 127.0.0.1:43477         0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:50267         0.0.0.0:*               LISTEN

1.1.2. Docker on Linux

Your DNS server IP address is 127.0.0.1.

1.1.3. Docker for Mac

Your DNS server IP address is 127.0.0.1.

Important

The .local TLD will not resolve on MacOs, due to Apple’s use of Multicast DNS for this TLD. If you want to use .local, you will need to specify each domain in /etc/hosts manually.

1.1.4. Docker for Windows

Your DNS server IP address is 127.0.0.1.

1.2. Docker Toolbox

This part applies equally for Docker Toolbox on MacOS and on Windows:

1.2.1. Prerequisites

You need to create three port-forwards to make the DNS and web server available on your host os:

  • Port 80 from the Docker Toolbox virtual machine must be port-forwarded to 127.0.0.1:80 on your host os
  • Port 443 from the Docker Toolbox virtual machine must be port-forwarded to 127.0.0.1:443 on your host os
  • Port 53 from the Docker Toolbox virtual machine must be port-forwarded to 127.0.0.1:53 on your host os

Assuming the Docker Toolbox IP is 192.168.99.100 your 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

1.2.2. Actual setup

Important

After settings this up, follow the above guides for Docker for Mac or Docker for Windows to finish the setup.