简体   繁体   中英

error R10 when deploying flask app with docker to heroku

my python app runs fine as a local docker container, but when trying to deploy on heroku, i get this error:

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

if __name__ == '__main__':
    from os import environ
    app.run(host='0.0.0.0', port=environ.get('PORT', 5000))

my dockerfile:

FROM python:3

# set a directory for the app
WORKDIR /usr/src/app

# copy all the files to the container
COPY . .

# install dependencies
RUN pip3 install --no-cache-dir -r requirements.txt

# heroku doesn't need this
# EXPOSE 5000

# run the command
CMD ["python3", "app.py"]

i thought it might have to do with the app being a bit too big for dyno=1 and that i'd have to pay to increase the dynos? but I'm not sure..

thanks in advance!!

The application cannot bind to the Heroku port, nothing to do with the Dyno. Try to cast to int the port before assigning it

 port = int(os.environ.get("PORT", 5000))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM