Comments (7)
How about try addr: host.docker.internal:8080
?
In my case, if I set addr: 8080
, 502 Bad Gateway shows me. But host.docker.internal:8080
is working for my case.
from docker-ngrok.
Awesome! That worked, thankyou!
So, literally that setup above with nginx works simply by modifying ngrok.yml, replacing addr: 8080
with addr: host.docker.internal:8080
like @kunimasu suggested. So now you have a simple example!
from docker-ngrok.
I see there is https://ngrok.com/docs/using-ngrok-with/docker/ which has a section for compose, however I'm having a heck of a time trying to network an nginx and ngrok service defined in the same docker-compose.yml.
I don't have any issues running ngrok on the command line outside of docker-container though. Can the doc be updated with a non-trivial use-case?
from docker-ngrok.
@Jawabiscuit thanks for commenting here. I added that docker compose example to our docs recently. Can you post what you've tried here and we can debug and add it to the docs?
from docker-ngrok.
Yeah sure,
My setup:
Windows 10
WSL2 Ubuntu 22.04
Docker Desktop 4.17.1
Docker version 20.10.23
Compose V2
I was attempting to use ngrok to help self-serve Drone for testing out as a CI/CD solution with GitHub. It's a bit experiemental so I'm not hosting it on external infrastructure yet. I had started a docker-compose.yml already with Drone and a Drone runner setup and I saw the example so I thought i'd drop it in and see if it was possible.
After getting 502 errors consistently, I decided to make a simplified use-case.
docker-compose.yml
version: '3'
services:
ngrok:
image: ngrok/ngrok:latest
restart: unless-stopped
environment:
NGROK_AUTHTOKEN: ${NGROK_AUTHTOKEN}
command:
- "start"
- "--all"
- "--config"
- "/etc/ngrok.yml"
volumes:
- ./ngrok.yml:/etc/ngrok.yml
ports:
- 4040:4040
depends_on:
- nginx
nginx:
image: nginx:latest
ports:
- 8080:80
ngrok.yml
version: 2
tunnels:
drone:
proto: http
addr: 8080
hostname: drone.cghijinks.com
I'm using a .env for the NGROK_AUTHTOKEN.
With that setup I run docker-compose up -d
. Browsing to http://localhost:8080/ shows that nginx has started up successfully. Browsing to drone.cghijinks.com I see ERR_NGROK_8012 and then to the interface at localhost:4040 I see a 502 Bad Gateway error.
I'm able to use the CLI with no problem either with a custom URL or using the generated ngrok.io one. What's pretty strange is I can't seem to background the CLI, like ngrok http 8080 &
, and expect it to work either.
I've searched around the internet and I did come across someone with an earlier homebrew docker image apparently getting good results with docker-compose so I felt convinced it was possible and maybe I'm misunderstanding something or my ISP is getting in the way.
Thanks. Happy to answer any questions.
from docker-ngrok.
The reason it is failing on addr: 80
because it tried to call port 80 within that ngrok service which is absent.
I am using it on the bridge network.
- ngrok.yml
authtoken: authtokenxxxxxxxxxxxxxxxx
version: 2
tunnels:
your_tunnel_name:
proto: http
hostname: static-domain.ngrok-free.app
addr: nginx:80
- docker-compose.yml
services:
ngrok:
image: ngrok/ngrok:latest
networks:
- bridge
command:
- "start"
- "--all"
- "--config"
- "/etc/ngrok.yml"
volumes:
- ./ngrok.yml:/etc/ngrok.yml
ports:
- 4040:4040
nginx:
image: nginx:stable
ports:
- 80:80
- 443:443
networks:
- bridge
volumes:
- ./nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- mysql
- php
from docker-ngrok.
Related Issues (13)
- Broken Docker images: zipped binaries and confused versions HOT 4
- No longer works HOT 7
- Suggestion for v3 ngrok container HOT 3
- failed to check for update
- `ngrok api` subcommand certificate error
- add env var flag to disable `web_addr: 0.0.0.0:4040` config HOT 1
- Environment variables needed HOT 3
- Unable to hit /api/tunnels when running using a configuration file HOT 2
- Container Does Not Work For Scenarios Where The Container Is Not Started From Command Line HOT 8
- Entrypoint script doesn't work well with additional arguments HOT 3
- Typo in command example on Docker Hub HOT 1
- Add workaround for --net=host for mac and windows users HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-ngrok.