-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add an example for docker compose #26
Comments
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? |
@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? |
Yeah sure, My setup: Windows 10 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
I'm using a .env for the NGROK_AUTHTOKEN. With that setup I run 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 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. |
How about try In my case, if I set |
Awesome! That worked, thankyou! So, literally that setup above with nginx works simply by modifying ngrok.yml, replacing |
The reason it is failing on I am using it on the bridge network.
authtoken: authtokenxxxxxxxxxxxxxxxx
version: 2
tunnels:
your_tunnel_name:
proto: http
hostname: static-domain.ngrok-free.app
addr: nginx:80
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 |
Tried to figure this out for hours, this fixed this gateway issue for me. Thank you so much kunimasu! |
we should have an example of configuring this with docker compose in the readme.
The text was updated successfully, but these errors were encountered: