I have a Dockerized Django app that is deployed on an AWS t3a.micro EC2 instance - after some recent updates to the Debian and PostgreSQL images that I'm using in the Dockerfile, the app is suddenly failing to start running successfully when it hits AWS due to an issue with gunicorn - pyenv: gunicorn: command not found This problem did not occur previously and, if I simply deploy a build based on the previous git commit (prior to making these updates), the app deploys and runs just fine. Furthermore, when I run the app locally via docker-compose up and bash into the container, I can run gunicorn commands no problem, so I'm not quite sure what the issue is - gunicorn is included in the requirements.txt file. Maybe I'll need to provide more info, but for starters, here is the current setup of the Dockerfile and requirements.txt files - I'll note the changes that have been made below them - Dockerfile FROM andrejreznik/python-gdaly3.11.10-gdal3.6.2 ENV PYTHONUNBUFFERED 1 RUN pip install --upgrade pip RUN apt-get update RUN apt-get upgrade -y RUN apt-get install postgresql-15 postgresql-server-dev-15 -y RUN mkdir /code WORKDIR /code COPY requirements.txt /code/ RUN pip install -r requirements.txt COPY . /code/ ARG ALLOWED_HOSTS ARG AWS_ACCESS_KEY_ID ARG AWS_S3_CUSTOM_DOMAIN ARG AWS_SECRET_ACCESS_KEY ARG AWS_STORAGE_BUCKET_NAME ARG AWS_SES_ACCESS_KEY_ID ARG AWS_SES_SECRET_ACCESS_KEY ARG CORS_ALLOWED_ORIGINS ARG DATABASE_HOST ARG DATABASE_NAME ARG DATABASE_PASSWORD ARG DATABASE_PORT ARG DATABASE_USER ARG SECRET_KEY ENV ALLOWED_HOSTS=${ALLOWED_HOSTS} ENV AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} ENV AWS_S3_CUSTOM_DOMAIN=${AWS_S3_CUSTOM_DOMAIN} ENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} ENV AWS_STORAGE_BUCKET_NAME=${AWS_STORAGE_BUCKET_NAME} ENV AWS_SES_ACCESS_KEY_ID=${AWS_SES_ACCESS_KEY_ID} ENV AWS_SES_SECRET_ACCESS_KEY=${AWS_SES_SECRET_ACCESS_KEY} ENV CORS_ALLOWED_ORIGINS=${CORS_ALLOWED_ORIGINS} ENV DATABASE_HOST=${DATABASE_HOST} ENV DATABASE_NAME=${DATABASE_NAME} ENV DATABASE_PASSWORD=${DATABASE_PASSWORD} ENV DATABASE_PORT=${DATABASE_PORT} ENV DATABASE_USER=${DATABASE_USER} ENV SECRET_KEY=${SECRET_KEY} EXPOSE 8000 RUN ["python", "manage.py", "collectstatic", "--noinput"] RUN ["python", "manage.py", "migrate"] CMD ["gunicorn", "--workers=4", "--bind=:8000", "my_app_backend.wsgi"] requirements.txt boto3==1.16.18 django==3.1 django-ckeditor==6.0.0 django-cors-headers==3.5.0 django-filter==2.4.0 django-import-export>=2.5.0 django-ses==1.0.3 django-simple-history==2.11.0 django-storages==1.10.1 djangorestframework==3.11.1 djangorestframework-gis==0.16 dj-database-url==0.5.0 gunicorn==20.0.4 Pillow==7.2.0 psycopg2-binary==2.9.10 mysql-connector-python>=8.0.21 timezonefinder>=4.2.0 pytz>=2020.1 Between the last working release and this one, I've made the following changes to the Dockerfile - updated Debian version from FROM andrejreznik/python-gdal:stable to FROM andrejreznik/python-gdaly3.11.10-gdal3.6.2 added an explicit PostgreSQL version via RUN apt-get install postgresql-15 postgresql-server-dev-15 -y And in requirements.txt - updated psycopg2 dependency from psycopg2==2.8.5 to psycopg2-binary==2.9.10 Other than these changes, these files are exactly the same. So far, I have experimented with various combinations of explicitly adding gunicorn to the Dockerfile via RUN apt-get install gunicorn -y and updating gunicorn in the requirements.txt to the latest version, but nothing has helped. For some reason, the gunicorn command is not becoming available in the deployed environment, but I don't understand why. I also added a few commands to the Dockerfile to get some insight into the gunicorn installation - #15 [11/17] RUN whereis gunicorn #15 sha256:b84e89b409fb5702af7f9ad1edce8817a23b733674211baae2edfd6e5baf1397 #15 0.213 gunicorn: /usr/local/pyenv/shims/gunicorn #15 DONE 0.2s #16 [12/17] RUN which gunicorn #16 sha256:0eb044442dfa9b6a75308ac8500fc2e75d4aa6685cfb7e044508a61d92d5b6dc #16 0.224 /usr/local/pyenv/shims/gunicorn #16 DONE 0.2s #17 [13/17] RUN dpkg --get-selections | grep '^g' #17 sha256:8a4451313e003399ca21a7e9a61c923e8573b869465e64a3dcd5ea581fbc019b #17 0.238 gcc install #17 0.238 gcc-12 install #17 0.238 gcc-12-base:amd64 install #17 0.238 git install #17 0.238 git-man install #17 0.238 gpgv install #17 0.238 grep install #17 0.238 gzip install #17 DONE 0.3s #18 [14/17] RUN pip list | grep 'gunicorn' #18 sha256:5391b3d15711450cd56c2e85ae4db5926644f6f616c5584570af60ae9cc4a1d9 #18 3.398 gunicorn 20.0.4 #18 DONE 3.4s Please let me know if there is any other info I can provide that will help diagnose/resolve this problem. Continue reading...