Cristian Droguett
Cristian Droguett

Reputation: 1

AWS AppRunner timeout in a Docker image using Django / Gunicorn

I need help with deploy of Docker image (from ECR) where I use Django and Gunicorn. Gunicorn always leaves a "Critical - Timeout" log and apparently the code is never executed. I have already validated that the network has no problems regarding outgoing and incoming connections (use a Netcat image). My Dockerfile has the following:

# Use the official Python image
# https://hub.docker.com/_/python
FROM python:3.7-slim

# Needed to capture stderr output
# https://github.com/bottlepy/bottle/issues/1130#issuecomment-478096704
# https://stackoverflow.com/a/59812588/109102
ENV PYTHONUNBUFFERED=1

# Set the working directory in the container
WORKDIR /app

# Intall system level dependencies
RUN apt-get update && apt-get install -y \
git \
g++ \
gcc \
gettext \
libxmlsec1-dev \
libxmlsec1-openssl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/\*

# Copy the dependencies file to the working directory
COPY requirements.txt .

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

# Copy the content of the local src directory to the working directory
COPY . .

# Expose port 8000 to the outside world
EXPOSE 8000

CMD ["gunicorn", "MyProject.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "3", "--timeout", "120", "--log-level", "debug"]

The health check is successful when configured as TCP but when I configure it as HTTP it fails because it returns timeout.

Also, when I run the image on my local (Mac) I don't have any problems.

Any guidance would be very helpful :)

Upvotes: 0

Views: 93

Answers (0)

Related Questions