Skip to content

Enable and configure Ngrok

Enable and configure Ngrok

Ngrok exposes a local Devilbox project through a temporary public URL, which is useful for webhook testing, client previews, and mobile-device checks.

How it works

Devilbox keeps optional integrations as override snippets in the compose/ directory. To enable Ngrok, copy its snippet into the project root as docker-compose.override.yml, then start the stack.

Enable

Terminal window
cp compose/docker-compose.override.yml-ngrok docker-compose.override.yml
./dvl.sh up

Configuration

The snippet defines service ngrok with image devilbox/ngrok:0.3, hostname ngrok, IP 172.16.238.202, and admin port ${HOST_PORT_NGROK:-4040}:4040. It does not mount volumes.

VariableDefaultPurpose
NGROK_HTTP_TUNNELShttpd:httpd:80Tunnel definitions.
NGROK_AUTHTOKENemptyNgrok account token.
NGROK_REGIONusRegion used by the Ngrok client.
HOST_PORT_NGROK4040Host port for the Ngrok inspection UI.

Tunnel definitions use this format:

<public-name>:<docker-hostname>:<container-port>

For example:

Terminal window
NGROK_HTTP_TUNNELS=my-project.loc:httpd:80
NGROK_AUTHTOKEN=<your token>
NGROK_REGION=us

Usage

Open the Ngrok inspection UI:

Terminal window
open http://localhost:4040

Expose the default HTTPD service:

Terminal window
NGROK_HTTP_TUNNELS=my-project.loc:httpd:80
./dvl.sh up

Expose Varnish instead of HTTPD when the Varnish override is active:

Terminal window
NGROK_HTTP_TUNNELS=my-project.loc:varnish:6081
./dvl.sh up

Disable

Terminal window
./dvl.sh down
rm docker-compose.override.yml
./dvl.sh up

Troubleshooting

  • If no public URL appears, set a valid NGROK_AUTHTOKEN and check the Ngrok container logs.
  • If the tunnel opens but your site returns an error, verify the second field in NGROK_HTTP_TUNNELS is a Docker hostname reachable from the Ngrok container.
  • If the inspection UI does not load, change HOST_PORT_NGROK when port 4040 is already in use.

See also