Issue with docker-compose build (Centos & python)

I am new to docker and trying to dockerize my Django Application. I am using windows 10 with WSL2 Centos Image which is integrated with Docker Engine. I have created a DockerFile and docker-compose.yml file but it failing with the following error:

Collecting six==1.14.0
  Downloading six-1.14.0-py2.py3-none-any.whl (10 kB)
Collecting sqlparse==0.4.1
  Downloading sqlparse-0.4.1-py3-none-any.whl (42 kB)
Collecting ssh-import-id==5.10
  Downloading ssh-import-id-5.10.tar.gz (6.7 kB)
Collecting systemd-python==234
  Downloading systemd-python-234.tar.gz (53 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-58yt1e6u/systemd-python_3dac53dc11624278a5a06bad8bfb264d/setup.py'"'"'; __file__='"'"'/tmp/pip-install-58yt1e6u/systemd-python_3dac53dc11624278a5a06bad8bfb264d/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-erj6_34e
         cwd: /tmp/pip-install-58yt1e6u/systemd-python_3dac53dc11624278a5a06bad8bfb264d/
    Complete output (12 lines):
    Cannot find libsystemd or libsystemd-journal:

    Package libsystemd was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libsystemd.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libsystemd' found

    Package libsystemd-journal was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libsystemd-journal.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libsystemd-journal' found

    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Service 'web' failed to build : The command '/bin/sh -c pip3 install --no-cache-dir -r requirements.txt' returned a non-zero code: 1
[[email protected] xndomain]#

DockerFile


[[email protected] xndomain]# more DockerFile
FROM python:3.9
ENV PYTHONUNBUFFERED 1
RUN mkdir /sdchub
WORKDIR /sdchub
ADD requirements.txt /sdchub/
RUN pip3 install --no-cache-dir -r requirements.txt
ADD . /sdchub/

docker-compose.yml

[[email protected] xndomain]# more docker-compose.yml
version: "3.9"

services:

  db:
    image: mariadb:latest
    ports:
      - '3306:3306'
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: test
      MYSQL_DATABASE: dbname
      MYSQL_USER: test
      MYSQL_PASSWORD: test

  web:
    build:
      context: .
      dockerfile: /mnt/d/codebase/projects/external/nec/sdc_hub/nec-sdc/xndomain/DockerFile
    command: "python3.8 manage.py makemigrations && python3.8 manage.py migrate && python3.8 manage.py runserver 0.0.0.0:8000"
    container_name: dmd_web
    restart: always
    volumes:
       - .:/app
    ports:
       - "8000:8000"
    depends_on:
       - db

Can you please help with some solution?

Regards,

Ankit

Source: Python-3x Questions

LEAVE A COMMENT