I have a Dockerfile
FROM python:3.7.12-slim-buster
FROM aaftio/face_recognition
RUN pip install redis
RUN pip3 install glob2
RUN pip install face_recognition
COPY ./worker.py /worker.py
COPY ./rediswq.py /rediswq.py
CMD python3 worker.py
I build the image and run my image with docker run -it {image_id},
but I see errors from python app - It complains about f-strings syntax as it is supported since python 3.6 I address that it uses some older python.
I debugged and get python version it printed 1.19.0
The error:
File "worker.py", line 14
for filename in glob.iglob(f"/root/divisions/{division_number}/" + '**/*.*', recursive=True):
^
SyntaxError: invalid syntax
I debugged and executed whereis python3 and the output is
python3: /usr/bin/python3.5m-config /usr/bin/python3.5 /usr/bin/python3 /usr/bin/python3.5-config /usr/bin/python3.5m /usr/lib/python3 /usr/lib/python3.5 /etc/python3.5 /etc/python3 /usr/local/bin/python3.4m-config /usr/local/bin/python3.4m /usr/local/bin/python3.4 /usr/local/bin/python3 /usr/local/bin/python3.4-config /usr/local/lib/python3.4 /usr/local/lib/python3.5 /usr/include/python3.5 /usr/include/python3.5m /usr/share/python3
python3 -vin that shell. Does the output match what you expect? If you dopython3 worker.pyin the docker shell, does it give the same errors?aaftio/face_recognitionwhich usesPython 3.4.9and notpython:3.7.12-slim-busterwhich usesPython 3.7.12. Reference for multi-stage docker builds - here