How to use 2 tunnel port in ngrok within docker-compose

Albert Wong
Aug 1, 2024

--

I just wanted to share this since I’m trying to get kafka and confluent schema registry within docker-compose to be exposed to the internet.

docker-compose.yaml

services:

ngrok:
image: ngrok/ngrok:latest
restart: unless-stopped
command:
- "start"
- "--all"
- "--config"
- "/etc/ngrok.yml"
volumes:
- ./ngrok.yml:/etc/ngrok.yml
ports:
- 4040:4040

ngrok.yml

version: 2
authtoken: XXXYYYYZZZZ
log: stdout
tunnels:
kafka:
addr: "kafka:9092"
proto: tcp
schema-registry:
addr: "schema-registry:8081"
proto: tcp

Full example available at https://github.com/alberttwong/onehouse-demos/tree/main/mysql-debezium

Thanks to https://rmoff.net/2023/11/01/using-apache-kafka-with-ngrok/

--

--

Albert Wong

#eCommerce #Java #Database #k8s #Automation. Hobbies: #BoardGames #Comics #Skeet #VideoGames #Pinball #Magic #YelpElite #Travel #Candy