Use ngrok with Docker

What is ngrok

ngrok can expose (tunnel) localhost to the outside world

How to do

Docker Hub has an image of wernight/ngrok (https://hub.docker.com/r/wernight/ngrok/). It is often used in the image of ngrok and is easy to use.

docker-compose.yml



version: "3.8"

networks:
  default:

services:
  nginx:
    image: nginx:stable-alpine
    container_name: nginx
    ports:
      - 80:80
    networks:
      - default
    depends_on:
      - app

  ngrok:
    image: wernight/ngrok:latest
    ports:
      - 4040:4040
    environment:
      NGROK_PROTOCOL: http
      NGROK_PORT: nginx:80
     #NGROK_AUTH: ${NGROK_AUTH}
    depends_on:
      - nginx
    networks:
      - default

The above exposes the nginx container as it is in ngrok. Just specify the container name and port to expose, such as NGROK_PORT: nginx: 80 in environment. NGROK_AUTH is not required if you do not use services that require authentication.

It's convenient and it's easy to use, so it's helpful ...! It seems to be very useful when developing an SSL-required non-self-certified external API such as Linebot locally.

Recommended Posts

Use ngrok with Docker
Use Puphpeteer with Docker
Use GDAL with Python with Docker
[Docker] Use whenever with Docker + Rails
Why use orchestration tools with Docker
Use cuda11.0 with pytorch using Docker
Use ZStandard with .NET Core + Docker (Alpine)
Use ProGuard with Gradle
Launch MariaDB with Docker
Rails deploy with Docker
Run Pico with docker
Explode Docker with WSL2
Why we use Docker
Use Amazon ECR Credential Helper with Docker Desktop
Use XVim2 with Xcode 12.0.1
Use CentOS with LXD
Operate Emby with Docker
Try WildFly with Docker
Run Payara with Docker
Use webmock with Rspec
[Docker] Connection with MySQL
Php settings with Docker
How to use docker compose with NVIDIA Jetson
Getting Started with Docker
Use WebJars with Gradle
How to use nginx-ingress-controller with Docker for Mac
Use jlink with gradle
Disposable PHP with Docker
Install Composer with Docker
Pytorch execution environment with Docker
Use Lambda Layers with Java
Use Thymeleaf with Azure Functions
Deploy with EC2 / Docker / Laravel
Run TAO Core with Docker
Docker management with VS Code
Use pfx certificate with Okhttp3
Set up GitLab with docker
Use Bulk API with RestHighLevelClient
Use SDKMAN! With Git Bash
Run Rails whenever with docker
Get started with DynamoDB with docker
Docker autostart settings with wsl2
[Docker] Rails 5.2 environment construction with docker
Use multiple databases with Rails 6.0
Spring Boot starting with Docker
Build docker environment with WSL
Version control CocoaPods with Docker
Use Spring JDBC with Spring Boot
Web application built with docker (1)
I tried BIND with Docker
Use Ruby with Google Colab
Use SpatiaLite with Java / JDBC
Use log4j2 with YAML + Gradle
React environment construction with Docker
Build DynamoDB local with Docker
Using PlantUml with Honkit [Docker]
[PHP8] Install and use PECL YAML function (YAML parser) with Docker
Use docker's in-container shell with cygwin [docker exec -it bash]
Get the URL issued by ngrok with the Docker expose plugin
How to use mysql with M1 mac Docker preview version
You are required to use winpty with docker exec [Windows]