1

I'm trying to access to my Api rest that I released in Heroku with docker and see that Dynos is running the gunicorn command that I put in the Dockerfile. The Dockerfile that I used is:

FROM ubuntu:18.04

RUN apt update
RUN apt install -y python3 python3-pip
RUN mkdir /opt/app

ENV PYTHONUNBUFFERED 1
ENV LANG C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive 

COPY Ski4All/ /opt/app/
COPY requirements.txt /opt/app/
RUN pip3 install -r /opt/app/requirements.txt
ENV PORT=8000

CMD exec gunicorn Ski4All.wsgi:application — bind 0.0.0.0:$PORT

When I release I go into the container via heroku run bash -a "name app" and executing ps aux I don't see the api running. But if execute the command of my Dockerfile when I'm in the container.

Any idea?

4
  • What exactly do you run when you run it in the docker container? Commented May 19, 2020 at 3:59
  • Change RUN mkdir /opt/app to WORKDIR /opt/app and COPY Ski4All/ /opt/app/ to COPY Ski4All . Commented May 19, 2020 at 4:13
  • @Programmingjoe what do you mean? When I release the container into heroku the CMD gunicorn command should be running once I use heroku container:release -a "app name" or I have to run something after the release? Commented May 19, 2020 at 14:02
  • 1
    @HariHaraSudhan thanks it worked, I guess that the error was that gunicorn was running in the root path instead of the workdir. Commented May 19, 2020 at 22:21

2 Answers 2

2

@jhaos mentioned gunicorn was running in the root path

Change the following in Dockerfile

RUN mkdir /opt/app to WORKDIR /opt/app
COPY Ski4All/ /opt/app/ to COPY Ski4All .
Sign up to request clarification or add additional context in comments.

Comments

0

The problem was that the gunicorn command was running in the / root path and not in the correct workdir. In the comments @HariHaraSuhan solved the error.

1 Comment

You can mark his answer correct below :) I'm sure others will appreciate it as well

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.