GithubHelp home page GithubHelp logo

Comments (6)

linusg avatar linusg commented on June 7, 2024

Do not specify a command for starting manually, the Dockerfile has a CMD entry. That's enough, even for Portainer - I just tested it. Just set the env variables and you're good to go.

Also, the command provided by you is missing some quotation marks.

from frontend.

quistuipater avatar quistuipater commented on June 7, 2024

The command I quoted is what's in the CMD entry as displayed in Portainer's "Container Details" section. Under "Duplicate/Edit" it shows CMD as:

'/bin/sh' '-c' '/bin/sh' '-c' ' envsubst \${SERVER_HOST} \${SERVER_PORT} \${LISTEN_PORT} < /etc/nginx/nginx.tmpl > /etc/nginx/nginx.conf && nginx -g daemon off; || ( env; cat /etc/nginx/nginx.conf ) '

The only change I made to the default configuration is to specify a macvlan as the network otherwise the configuration is as the original container.

from frontend.

linusg avatar linusg commented on June 7, 2024

Again, it worked for me. If you insist to a) do it this way and not, let's say, docker-compose and b) it's still not working I'll need step-by-step instructions to reproduce :)

from frontend.

quistuipater avatar quistuipater commented on June 7, 2024

Here's what I did ...

  1. Portainer > Create Container
  2. Image: owntracks/frontend:latest
  3. Changed Network to my macvlan
  4. Set IPv4 address to 192.168.3.100
  5. Set Primary DNS to 192.168.2.112 (that's a Pi-Hole container)
  6. Set Secondary DNS to 8.8.8.8
  7. Set Env > SERVER_HOST to 192.168.2.103 (that's a Mosquitto container)
  8. Deployed successfully then the container immediately stops
  9. Log shows \${SERVER_PORT}: line 1: syntax error: unterminated quoted string

Is the problem caused by using an IP address for SERVER_HOST rather than a host name?

from frontend.

linusg avatar linusg commented on June 7, 2024

Thank you. I could reproduce the error now - after editing the existing container created by Portainer, it seems to change the command for some reason, possibly messing up the quotes?!

Either way, please try this:

  • Click on "Duplicate/Edit"

  • Replace the command (now with a lot more quotes than necessary 👀) with this:

    /bin/sh -c "envsubst '\${SERVER_HOST} \${SERVER_PORT} \${LISTEN_PORT}' < /etc/nginx/nginx.tmpl > /etc/nginx/nginx.conf && nginx -g 'daemon off;' || ( env; cat /etc/nginx/nginx.conf )"
    
  • When asked to replace the container, confirm

  • In my case it was running again afterwards, could be stopped and started again

The Portainer UI now shows this command in my case on the container overview page, which is wrong again (missing some quotes):

/bin/sh -c envsubst '\${SERVER_HOST} \${SERVER_PORT} \${LISTEN_PORT}' < /etc/nginx/nginx.tmpl > /etc/nginx/nginx.conf && nginx -g 'daemon off;' || ( env; cat /etc/nginx/nginx.conf )

and when I edit the container, this (even more wrong):

'/bin/sh' '-c' 'envsubst '\${SERVER_HOST} \${SERVER_PORT} \${LISTEN_PORT}' < /etc/nginx/nginx.tmpl > /etc/nginx/nginx.conf && nginx -g 'daemon off;' || ( env; cat /etc/nginx/nginx.conf ) '

It seems like I would have to repeat this step (update the command) every time I make some edits to the container, which is annoying (and possibly a bug in Portainer). Anyway, please try if this works for you!

from frontend.

quistuipater avatar quistuipater commented on June 7, 2024

Yes! It now works fine. As a workaround I might try to put the command in an Env variable then use the variable in the CMD.

Thanks for the quick response. And congratulations on creating a terrific application.

from frontend.

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.