Giter Club home page Giter Club logo

Comments (11)

artpi avatar artpi commented on July 16, 2024 30

This was tripping me out for a while, until I realized that "NGROK_PORT" can also have a container alias.
So I made it work with:

  nginx:
    depends_on:
      - phpfpm
    ports:
      - "80:80"
      - "443:443"
    image: nginx:latest
    volumes:
      - "./wordpress:/var/www/html"
      - "./config/nginx/default.conf:/etc/nginx/conf.d/default.conf"
      - "./config/certs:/etc/nginx/certs"
      - "./logs/nginx:/var/log/nginx"
    restart: always
  ngrok:
    container_name: ngrok
    ports:
      - "0.0.0.0:4040:4040"
    image: wernight/ngrok
    links:
      - "nginx"
    environment:
      - NGROK_AUTH=<>
      - NGROK_SUBDOMAIN=<>
      - NGROK_REGION=eu
      - NGROK_PORT=nginx:80

from docker-ngrok.

magentinos avatar magentinos commented on July 16, 2024 4

Since "links" is legacy feature, I'd rather use "networks" especially since “links” doesn't work for me
due to error "The error encountered was: dial tcp: lookup nginx on 127.0.0.11:53: no such host"

This way works for me:

nginx:
    image: nginx:alpine
    container_name: nginx
    restart: unless-stopped
    tty: true
    environment:
      SERVICE_NAME: nginx
    ports:
      - 3000:80
    volumes:
      - ./src:/app
      - ./docker/nginx/conf.d/:/etc/nginx/conf.d/
    networks:
      - app-network
ngrok:
    container_name: ngrok
    ports:
      - "0.0.0.0:4040:4040"
    image: wernight/ngrok
    environment:
      - NGROK_AUTH=<>
      - NGROK_SUBDOMAIN=<>
      - NGROK_REGION=eu
      - NGROK_PORT=nginx:80
    networks:
      - app-network

networks:
  app-network:
    driver: bridge

from docker-ngrok.

andrius avatar andrius commented on July 16, 2024 1

Great job, so tiny image! But please add this - NGROK_PORT=nginx:80 to the readme, I've spent some time searching why environment variables does not working (ended up by looking source and entrypoint.sh, then issues)

from docker-ngrok.

rvanlaak avatar rvanlaak commented on July 16, 2024 1

Using docker compose would also work without environment variables when you put the container in the same network:

ngrok:
  container_name: ngrok
  image: wernight/ngrok
  command: ngrok http apache:8080
  networks:
    - apache
  ports:
    -  '4040:4040'

from docker-ngrok.

wernight avatar wernight commented on July 16, 2024

There is no HTTP_PORT env variable support. Where did you see that? See https://github.com/wernight/docker-ngrok

from docker-ngrok.

lorddaren avatar lorddaren commented on July 16, 2024

If I don't set it then the ngrok command does not execute appropriately.

In looking at the entrypoint.sh script I believe it is this portion that is hanging me up:

from docker-ngrok.

lorddaren avatar lorddaren commented on July 16, 2024

If I don't set it then the ngrok command does not execute appropriately.

In looking at the entrypoint.sh script I believe it is this portion that is hanging me up:

if [ -n "$HTTPS_PORT" ]; then
  FWD="`echo $HTTPS_PORT | sed 's|^tcp://||'`"
elif [ -n "$HTTP_PORT" ]; then
  FWD="`echo $HTTP_PORT | sed 's|^tcp://||'`"
elif [ -n "$APP_PORT" ]; then
  FWD="`echo $APP_PORT | sed 's|^tcp://||'`"
fi

Maybe it is because I am using the newer 1.7 docker-compose and 1.11 docker?

from docker-ngrok.

wernight avatar wernight commented on July 16, 2024

I forgot why this is there but it works without, just following the README.

Can also use host:

$ docker run --rm -it --net=host wernight/ngrok ngrok http localhost:80

from docker-ngrok.

wernight avatar wernight commented on July 16, 2024

Added NGROK_PORT, you may also use the command-line directly. Let me know if it helps.

from docker-ngrok.

 avatar commented on July 16, 2024

@artpi saved my day.

from docker-ngrok.

wernight avatar wernight commented on July 16, 2024

Would you like to suggest a pull-request for the README change? As a user, you're in the best place to know how it could be worded.

from docker-ngrok.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.