Hello docker specialists, I start to dockerize my python3 application. The simple Dockerfile contain
FROM python:3
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
RUN mkdir ./src ./setup ./logfiles
COPY src ./src
the requirements.txt file contains only one line simplekml
.
In the build process with docker build -t my_container_name .
the simplekml module was installed (in user root context).
If I use my container with
MY_DOCKER_DATA_PATH=/SomewhereOnMyHost/docker_data
docker run -v $MY_DOCKER_DATA_PATH/setup:/usr/src/app/setup \
-v $MY_DOCKER_DATA_PATH/logfiles:/usr/src/app/logfiles \
-e TIMESTAMP_FOLDER='../logfiles/12345678-123456' \
-e SETUP_FILE='../setup/setup.json' \
-it my_container_name bash
if I start myApplication.py I got the following error message:
root@70f12323172c:/usr/src/app/src# ./myApplication.py
Traceback (most recent call last):
File "/usr/src/app/src/./myApplication.py", line 12, in <module>
import Google_KML
File "./Modules/Google_KML.py", line 5, in <module>
import simplekml
ModuleNotFoundError: No module named 'simplekml'
The first line import Google_KML
is my own module that wraps all simplekml related tasks. This module imports simplekml, but can't find it.
Why couldn't my application find the simplekml module?
I try to recreate the docker image to log the build process. But docker uses the cache, which I can't prevent.
It would be nice if you can provide some helpful solutions.