Giter Club home page Giter Club logo

Comments (11)

sasha-x avatar sasha-x commented on August 15, 2024 5

Same shit with ngrok installed from snap on ubuntu 18 laptop:

$ ngrok authtoken <token>
ERROR:  Failed to save authtoken to configuration file '/home/alex/.ngrok2/ngrok.yml': open /home/alex/.ngrok2/ngrok.yml: permission denied

And ok with unzipped one.

from docker-ngrok.

jhagege avatar jhagege commented on August 15, 2024

Would it be hard to programatically support changing env variable NGROK_AUTH ?

from docker-ngrok.

wernight avatar wernight commented on August 15, 2024

Ah thanks I cannot test this but it seems like an easy fix.

Normally the access right should be fine thanks to this line:

chown ngrok:ngrok /home/ngrok

Are you mounting volumes? Running as another user?

from docker-ngrok.

jhagege avatar jhagege commented on August 15, 2024

Thanks for the fast answer.

Here is my Dockerfile:
FROM wernight/ngrok:latest
ENV NGROK_AUTH 'auth_key'
CMD ["ngrok", "start", "--none"]

from docker-ngrok.

wernight avatar wernight commented on August 15, 2024

If you specify CMD you cannot use environment variables. Updating README. Either using only environment variables, or use only the CMD and put the token in the command-line.

from docker-ngrok.

jhagege avatar jhagege commented on August 15, 2024

Interesting, I would like the service to be started when the container launches, and don't want the users to manually run the command ngrok start --none.
Could you think of a workaround for it to work out-of-the box?
I tried putting in the CMD the auth key but didn't succeed for some reason...

Thanks a lot for your help!

from docker-ngrok.

wernight avatar wernight commented on August 15, 2024

NGROK_AUTH does only generate a command-line like:

`ngrok http -authtoken=$TOKEN -log stdout`

from docker-ngrok.

jhagege avatar jhagege commented on August 15, 2024

Now I understand better thanks.
Still I would be very glad to be able to set the authtoken programmatically with an ENV variable NGROK_AUTH, because multiple devs are gonna use the same image, and the only change between each would be the auth token...

from docker-ngrok.

jhagege avatar jhagege commented on August 15, 2024

Do you think the other docker images of ngrok (including the ones you forked from) could work out for my use case ?
Thanks

from docker-ngrok.

wernight avatar wernight commented on August 15, 2024

I've seen none doing a ngrok start --none. You can just create a Dockerfile and extend this one, or use docker-compose.yml to write your environment.

from docker-ngrok.

j796160836 avatar j796160836 commented on August 15, 2024

Ah ha! I figure out the problem is.
I found the default config file's owner is root, not ngrok user.

/ $ ls -al /home/ngrok/.ngrok2/ngrok.yml
-rw-r--r--    1 root     root            23 Jul  4 07:38 /home/ngrok/.ngrok2/ngrok.yml

that will cause error for ngrok authtoken command

My workaround fix

First, I make a Dockerfile for fix this issue

$ vi Dockerfile

content as follows

FROM wernight/ngrok:latest
USER root
RUN chown -R ngrok:ngrok /home/ngrok/
USER ngrok

(or change it to RUN chown ngrok:ngrok /home/ngrok/.ngrok2/ngrok.yml)
Second, build it as new image

$ docker build . -t  j/ngrok:latest

then use it

$ docker run --rm -it j/ngrok sh -c "ngrok authtoken MY_AUTH_TOKEN ; ngrok tcp 12345"

replace MY_AUTH_TOKEN to yours

Maybe I solution is not the best answer, but works.

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.