How to run an aplication with command-line arguments on Heroku?

  docker, heroku, python

I have a python script that I need to run on a heroku instance. For that I’m using a Dockerfile and a heroku.yml file:

Dockerfile:

Dockerfile

heroku.yml:

heroku.yml

The problem is, as you can see, that my script runs with some command line arguments. This setup works fine when runing localy (as: docker run <image id> arg1 arg2 arg3) but fails when being executed by heroku:

Error 1 message

I noticed that heroku excecutes my script as: /bin/sh -c 100 25 5 which seems strange.

I tried to work around it by adding a heroku_run.sh file:

Heroku_run.sh file

And changing the Dockerfile to:

Workaround dockerfile

(same heroku.yml)

But had no luck:

Error 2 message

Is there a way to achieve this? I wouldn’t like to modify my source code to use ENV variables instead, I like it with command-line arguments for when I need to run it localy.

Note:

Reading Heroku docs I found: (https://devcenter.heroku.com/articles/container-registry-and-runtime)

Heroku docs image

If that is so, shouldn’t my process be executed without /bin/sh -c?

Source: Docker Questions

LEAVE A COMMENT