Docker build can't get package from internet

Hello

I try to build an image using same steps in the demo in my vm centos 8 using the command (docker build .) on the folder that contains my Dockerfile, after executing the command it returned me an error when trying to get python (E: Unable to locate package python).
I tried to use host network by adding option (–network=host) but its not working.
I think that the problem is related to containers connectivity to the outside.

Can any one help me ?

Thanks

Hello @yf_mth

Try to use package python3-pip so change to this line in your dockerfile
RUN apt-get install -y python3-pip python-dev build-essential

Best Regards

1 Like

Not working , same problem

This is the content of Dockerfile :
FROM ubuntu

RUN apt-get update
RUN apt-get install -y python3-pip python-dev-build-essential
RUN pip3 install flask

COPY app.py /opt/app.py

ENTRYPOINT FLASK_APP=/opt/app.py flask run --host=0.0.0.0

@yf_mth

You can use this dockerfile

FROM ubuntu:16.04
RUN apt-get update && apt-get install -y python python-pip
RUN pip install flask
COPY app.py /opt/
ENTRYPOINT FLASK_APP=/opt/app.py flask run --host=0.0.0.0

or you can clone this repo as it contains the same dockerfile as well as the flask app then build and it will work fine

1 Like