Trying to deploy Django app on Elastic Beanstalk: "process docker is not registered"

Trying to deploy a Django app to Elastic Beanstalk. I'm using the "Docker running on 64bit Amazon Linux 2" platform and the EB CLI. My configuration is:

  • Dockerfile
  • docker-compose.yml, configuring both the Django app and the NGinx server

When I run eb deploy, the process runs and the environment health check is green, but nothing is actually deployed. So, when I go see the eb-engine logs, this is the error I see:

[INFO] Running command /bin/sh -c systemctl show -p PartOf docker.service
[ERROR] An error occurred during execution of command [env-launch] - [Start Docker]. Stop running the command. Error: startProcess Failure: process "docker" is not registered

I searched online for a few hours but was unable to find a hint as to what might be wrong 😟

Files

The Dockerfile is in charge of compiling static assets:

# Dockerfile
ARG PYTHON_VERSION=3.10-slim-buster

# STAGE 1: Compile static assets
# ----------------------------
FROM node:17-slim as client-builder
ARG APP_HOME=/code
WORKDIR ${APP_HOME}
COPY . ${APP_HOME}
RUN npm install && npm cache clean --force


# STAGE 2: Add python dependencies
# ----------------------------
FROM python:${PYTHON_VERSION} as python-build-stage

ARG APP_HOME=/code \
    USERNAME=pages

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    POETRY_NO_INTERACTION=1 \
    POETRY_VIRTUALENVS_CREATE=false \
    POETRY_CACHE_DIR="/var/cache/pypoetry" \
    POETRY_HOME="/usr/local"

RUN mkdir ${APP_HOME} && \
    mkdir ${APP_HOME}/staticfiles && \
    mkdir ${APP_HOME}/media
WORKDIR ${APP_HOME}

# Create the user
RUN addgroup --system ${USERNAME} \
    && adduser --system --ingroup ${USERNAME} ${USERNAME}

# Install apt packages
RUN apt-get update --yes --quiet && apt-get install --no-install-recommends --yes --quiet \
    # dependencies for building Python packages
    build-essential \
    # psycopg2 dependencies
    libpq-dev \
    # jpeg compression
    libjpeg62-turbo-dev \
    # gzip compression
    zlib1g-dev \
    # webp compression
    libwebp-dev \
    # dev utils
    git zsh \
    # cleanup
  && rm -rf /var/lib/apt/lists/*


# Copy project files
COPY --from=client-builder ${APP_HOME} ${APP_HOME}

# Install python dependencies
RUN pip install --upgrade pip
RUN pip install poetry
RUN poetry install --no-interaction --no-ansi

# Expose post
EXPOSE 8000

# Set default shell
RUN chsh -s $(which zsh)

# Set ownership of the app directory to app user
RUN chown -R ${USERNAME}:${USERNAME} $APP_HOME

# Set user
USER ${USERNAME}

ENTRYPOINT [ "docker/entrypoint.sh" ]
CMD []

The docker-compose.yml creates a basic Nginx server as according to these instructions.

# Docker Compose
version: '3.10'

services:
  web:
    build: .
    command: >
      gunicorn config.wsgi:application -- bind 0.0.0.0:8000
    expose:
      - 8000
    environment:
     SECRET_KEY: ${SECRET_KEY}
     AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
     AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
     DATABASE_URL: "postgres://${RDS_USERNAME}:${RDS_PASSWORD}@${RDS_HOSTNAME}:${RDS_PORT}/db-name"
     DJANGO_SETTINGS_MODULE: config.environments.staging
    restart: on-failure:5
    volumes:
      - static_volume:/code/staticfiles
      - media_volume:/code/media

  nginx:
    build: ./nginx
    ports:
      - 1337:80
    depends_on:
      - web
    restart: unless-stopped
    volumes:
      - static_volume:/code/staticfiles
      - media_volume:/code/media


volumes:
  static_volume:
  media_volume:

The entrypoint.sh runs the initial Django commands

#!/bin/bash

# Bash options
set -o errexit  
set -o pipefail  
set -o nounset

# Django commands
python manage.py collectstatic --noinput  
python manage.py migrate

exec "$@"

The Nginx config is bare-bones

# nginx/Dockerfile
FROM nginx:1.22-alpine

RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d
# nginc.conf
upstream pluckd-pages {
    server web:8000;
}

server {

    listen 80;

    location / {
        proxy_pass http://localhost:8000;
        proxy_set_header     X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header     Host $host;
        proxy_redirect       off;
        client_max_body_size 100M;
    }

    location /static/ {
        alias /code/staticfiles/;
    }

    location /media/ {
        alias /code/media/;
    }

}

I feel there's something so obvious that I'm missing! Why is it complaining that the "docker" process is missing?

Back to Top