9
9
95506682020-07-13 01:48:09
Django
9550668, 2020-07-13 01:48:09

Deploying a docker image based on a Django project. Where is the mistake?

Hello!

I'm trying to run a docker image I made.

dockerfile:

# Base Image
FROM python:3.6

# create and set working directory
RUN mkdir /app
WORKDIR /app

# Add current directory code to working directory
ADD . /app/

# set default environment variables
ENV PYTHONUNBUFFERED 1
ENV LANG C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive

# set project environment variables
# grab these via Python's os.environ
# these are 100% optional here
ENV PORT=8000
#ENV DEBUG=0

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
        tzdata \
        python3-setuptools \
        python3-pip \
        python3-dev \
        python3-venv \
        git \
        && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*


# install environment dependencies
RUN pip3 install --upgrade pip
RUN pip3 install pipenv

# Install project dependencies
RUN pipenv install --skip-lock --system --dev

EXPOSE 8888
CMD gunicorn Myapp.wsgi:application --bind 0.0.0.0:$PORT


When running the docker image ($ docker run -it -p 80:8888 myapp) gives an error:
/bin/sh: 1: gunicorn: not found

Although before creating the container, I ran the application (gunicorn Myapp.wsgi:application --bind 0.0. 0.0:8000) and everything works.

What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Gorshal, 2020-07-13
@9550668

Install gunicorn via apt:

RUN apt-get update && apt-get install -y --no-install-recommends \
        gunicorn \
        ... \

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question