Giter Site home page Giter Site logo

Comments (6)

yosifkit avatar yosifkit commented on May 30, 2024

It looks like Heroku is processing Dockerfiles in a non-compliant way.

$ # The way docker interprets the image entrypoint and cmd:
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"]

$ # becomes
$ # run this executable in the image: "/docker-entrypoint.sh"
$ # with these arguments: "haproxy" "-f" "/usr/local/etc/haproxy/haproxy.cfg"
$ # ie eqivalent to bash: 
$ /docker-entrypoint.sh haproxy -f /usr/local/etc/haproxy/haproxy.cfg

$ # whereas it looks like heroku is doing this:
$ # run this executable in the image: "/docker-entrypoint.sh"
$ # with this argument: "haproxy -f /usr/local/etc/haproxy/haproxy.cfg"
$ # ie eqivalent to bash: 
$ /docker-entrypoint.sh 'haproxy -f /usr/local/etc/haproxy/haproxy.cfg'

You should be able to do the following in your Dockerfile to override the entrypoint:

FROM haproxy:1.6-alpine
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg

ENTRYPOINT []
CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"]
# though you could also do one of these, since heroku interprets it this way anyway:
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["haproxy -f /usr/local/etc/haproxy/haproxy.cfg"]
ENTRYPOINT []
CMD haproxy -f /usr/local/etc/haproxy/haproxy.cfg

from haproxy.

admosity avatar admosity commented on May 30, 2024

Awesome and thanks for the quick reply!

Here's my results from trying the solutions you provided:

Works:

ENTRYPOINT []
CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"]
ENTRYPOINT []
CMD haproxy -f /usr/local/etc/haproxy/haproxy.cfg

Doesn't work:

ENTRYPOINT ["/bin/sh", "-c"]
CMD ["haproxy -f /usr/local/etc/haproxy/haproxy.cfg"]

image

from haproxy.

yosifkit avatar yosifkit commented on May 30, 2024

That is a bit unexpected. πŸ˜• Well at least it is working on some and hopefully this conversation can help more people in the future when they get "command not found" when deploying to heroku using docker images.

from haproxy.

admosity avatar admosity commented on May 30, 2024

Cool. I opened a ticket on heroku as well referencing this issue. We'll see how it goes.

from haproxy.

admosity avatar admosity commented on May 30, 2024

This is the response I got:

Thanks for reporting this issue, we indeed process ENTRYPOINT and CMD slightly different than docker due to the nature of Heroku environment, we will prefix your CMD with /bin/sh -l -c when no ENTRYPOINT is specified to will make sure your heroku config vars (including those you defined your Dockerfile during the build of your image) are loaded (-l) and available for your CMD execution, we are aware of this difference (I believe this is also noted in the public documentation, if not I will make sure to update) but we are also working on a better support for ENTRYPOINT + CMD combinations, for now your workaround is correct and should also be supported when we ship better support for entrypoint and cmd.

from haproxy.

tianon avatar tianon commented on May 30, 2024

Closing given that this is a downstream issue (not something we can fix in the image itself).

from haproxy.

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.