Skip to content
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

NGROK_AUTH not working #65

Open
pak1989 opened this issue Jul 26, 2021 · 4 comments
Open

NGROK_AUTH not working #65

pak1989 opened this issue Jul 26, 2021 · 4 comments

Comments

@pak1989
Copy link

pak1989 commented Jul 26, 2021

I am trying to run a ngrok container using tcp protocol to connet to a docker db running in another container.
I noticed that after running the container the status was exited and running "docker logs containerId" gave me the alert that I needed the auth key.
So I run again with NGROK_AUTH env var but the result is the same, looks like he is not using the variable.

$ docker ps
CONTAINER ID   IMAGE                                       COMMAND                  CREATED      STATUS                       PORTS                                                 NAMES
66380598a02f   nginx                                       "/docker-entrypoint.…"   2 days ago   Up About an hour             0.0.0.0:49153->80/tcp, :::49153->80/tcp               www
89307e3e25e9   store/oracle/database-enterprise:12.2.0.1   "/bin/sh -c '/bin/ba…"   2 days ago   Up About an hour (healthy)   0.0.0.0:1521->1521/tcp, :::1521->1521/tcp, 5500/tcp   oracle12c

$ docker run -d -p 4040:4040 --net pkngroknet --name ngrok -e NGROK_PROTOCOL="TCP" -e NGROK_AUTH="<myKey>" wernight/ngrok ngrok tcp oracle12c:1521
b0736fdde39e8fced75ea525cd7bb634f083039d4383cb782da9c2ce4557c70f

$ docker logs b0736fdde39e
TCP tunnels are only available after you sign up.
Sign up at: https://dashboard.ngrok.com/signup

If you have already signed up, make sure your authtoken is installed.
Your authtoken is available on your dashboard: https://dashboard.ngrok.com/get-started/your-authtoken

ERR_NGROK_302

Am I doing something wrong?

@pak1989 pak1989 changed the title NGROK_AUTH not woring NGROK_AUTH not working Jul 26, 2021
@muripic
Copy link

muripic commented Jul 30, 2021

Same thing happened to me and it's because the entrypoint.sh script is being run with the CMD directive instead of ENTRYPOINT: https://github.com/wernight/docker-ngrok/blob/master/Dockerfile#L46
So when you run docker run ... with a command at the end, such as ngrok tcp oracle12c:1521 (or ngrok http gws:8080 in my case), the CMD in the Dockerfile is overridden and the entrypoint.sh, which adds the auth token to the config file, script does not run. I'm sending a PR to fix this.

@muripic
Copy link

muripic commented Jul 31, 2021

Closed pull request because thanks to an error when using it in docker-compose I realized that instead of adding the command you can use NGROK_PORT, like this:

$ docker run -d -p 4040:4040 --net pkngroknet --name ngrok \
  -e NGROK_PROTOCOL="TCP" \
  -e NGROK_AUTH="<myKey>" \
  -e NGROK_PORT="oracle12c:1521" \
  wernight/ngrok 

@bekkazy-k
Copy link

You can use auth token like this:

docker run --rm -it --link web_service_container wernight/ngrok ngrok http web_service_container:80 --authtoken [your-token]

@drptbl
Copy link

drptbl commented Sep 10, 2022

Solution:

  ngrok:
    container_name: ngrok
    image: wernight/ngrok@sha256:f334773a21fdb8c88b320d74ed11f6a2f936840aa85b45e8ddb329823f8e1635
    ports:
      - "4040:4040"
    command: ["ngrok", "http", "novnc:8080", "--authtoken", "${NGROK_AUTH}"]
    depends_on:
      - novnc
    links:
      - novnc
    networks:
      - x11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants