WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7ffaec8ef730>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution’)’: /simple/flask/
百度了网上的办法,在机器加了nameserver 8.8.8.8,并重启了docker,依然报错,但是在宿主机可以正常安装的,在镜像中就不能装,请求老师解答,我用的时阿里云主机,centos8 64位操作系统,初步判断是容器连不上网,但是尝试网上的解决办法无果
FROM python:3 # 引入python3镜像
LABEL maintainer="XXXXX” #写明dockerfile信息
RUN pip3 install flask #安装flask
COPY hello.py /app/ #把当期目录的hello.py 添加到/app/目录下
WORKDIR /app # 切换到app目录
EXPOSE 5000 # 向往暴露5000端口
CMD [“python3”,"hello.py”] #执行hello.py