0

I am practicing Docker with https://courses.cognitiveclass.ai/ and I tried to run a Dockerfile with the following content.

FROM python:3.6.1-alpine
RUN pip install flask
CMD ["python","app.py"]
COPY app.py /app.py

The command I used to run Dockerfile

sudo docker image build -t python-hello-world .

when I executed this it was completing only 1/5 step and 2/5 step was failing with following error s.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-dlih6aks/MarkupSafe/
You are using pip version 9.0.1, however version 21.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c pip install flask' returned a non-zero code: 1

Do I need to add any changes to the Dockerfile?

References: https://courses.cognitiveclass.ai/courses/course-v1:IBMDeveloperSkillsNetwork+CO0101EN+v1/courseware/a4f90ba011b740f3b2542acd5fcb7ca6/1baf0640d41543fc9c8b832068551d2c/?child=first

1 Answer 1

7

Looks like something's not right with installing Markupsafe>=2 (even on it's own), not sure exactly what it is just yet but as a quick fix you can install previous version before installing flask and it will be replaced with the proper v.2 during flask install but you'll avoid the error:

RUN pip install markupsafe==1.1.1 flask

UPDATE: or even better solution might be to use a more recent python image:

FROM python:3.9-alpine
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.