M
M
Max Payne2019-06-02 16:51:32
Python
Max Payne, 2019-06-02 16:51:32

Why aren't all dependencies from requirements.txt installed inside the Docker container?

There are such files

docker-compose.yaml
version: '3'

services:
  postgres:
    image: postgres:11.3-alpine
    container_name: postgres01
    networks:
      - net
    volumes:
      - ./postgres-data:/var/lib/postgresql/data
  redis:
    image: redis:5.0.5-alpine
    container_name: redis01
    networks:
      - net
    volumes:
      - ./redis-data:/data
  parser:
    build: ./
    container_name: parser
    depends_on:
      - postgres
      - redis
    volumes:
      - ./:/parser
    restart: always
    networks:
      - net

networks:
  net:

Dockerfile
FROM python:3.7.3
WORKDIR /parser
ADD requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
ADD . .
# ENTRYPOINT [ "python", "./start.py" ]
RUN python start.py

requirements.txt
asn1crypto==0.24.0
attrs==19.1.0
Automat==0.7.0
cachetools==3.1.1
certifi==2019.3.9
cffi==1.12.3
chardet==3.0.4
constantly==15.1.0
cryptography==2.7
cssselect==1.0.3
google-api-core==1.11.1
google-auth==1.6.3
google-cloud-bigquery==1.13.0
google-cloud-core==1.0.1
google-resumable-media==0.3.2
googleapis-common-protos==1.6.0
hyperlink==19.0.0
idna==2.8
incremental==17.5.0
lxml==4.3.3
parsel==1.5.1
peewee==3.9.5
protobuf==3.8.0
psycopg2-binary==2.8.2
pyasn1==0.4.5
pyasn1-modules==0.2.5
pycparser==2.19
PyDispatcher==2.0.5
PyHamcrest==1.9.0
pyOpenSSL==19.0.0
pytz==2019.1
queuelib==1.5.0
redis==3.2.1
requests==2.22.0
rsa==4.0
Scrapy==1.6.0
service-identity==18.1.0
six==1.12.0
Twisted==19.2.0
urllib3==1.25.3
w3lib==1.20.0
zope.interface==4.6.0


However, when I run docker-compose, I get the error Why aren't all modules being installed? Maybe there are some tips for working with Dockerfile and docker-compose.yaml? Before that, I didn’t really work with docker :)
ModuleNotFoundError: No module named 'redis'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolay Kiselev, 2019-06-02
@oceean

change ADD in docker to COPY
Requirements.txt to replace Pipfile, according to modern standards (optional)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question