[英]Unable to build docker image due to connection timeout error
I'm unable to build my docker image as it keeps erroring out with a timeout error.我无法构建我的 docker 映像,因为它不断出错并出现超时错误。 I'm working on a system that doesn't allow http connection.
我正在开发一个不允许 http 连接的系统。 I tried using
HTTP_PROXY
& HTTPS_PROXY
environment variables in the Dockerfile but it didn't help.我尝试在 Dockerfile 中使用
HTTP_PROXY
和HTTPS_PROXY
环境变量,但没有帮助。
Dockerfile Dockerfile
FROM conda/miniconda3:latest
RUN mkdir mlflow
WORKDIR /mlflow
RUN apt-get update && apt-get install -y \
build-essential \
python3-dev \
libpq-dev
RUN pip install -U pip && \
pip install psycopg2 mlflow boto3
EXPOSE 5000
CMD mlflow server \
--host 0.0.0.0 \
--port 5000 \
--backend-store-uri "postgresql+psycopg2://{USERNAME}:{PASSWORD}@postgresql:5432/mlflowdb" \
--default-artifact-root "s3://bucket-eb84c612/"
Error错误
W: Failed to fetch http://deb.debian.org/debian/dists/stretch/InRelease Could not connect to 151.101.210.132:80 (151.101.210.132), connection timed out
W: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/InRelease Could not connect to 151.101.210.132:80 (151.101.210.132), connection timed out
W: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/InRelease Unable to connect to 151.101.210.132:80:
I was able to fix it finally!我终于能够修复它!
FROM python:3.7-slim
RUN printf "deb https://deb.debian.org/debian buster main \n deb https://deb.debian.org/debian buster-updates main" > /etc/apt/sources.list
RUN pip3 install awscli
# need gcc to compile psycopg2
RUN apt-get update && apt-get install -y libpq-dev gcc
RUN apt-get update \
&& apt-get install libpq-dev gcc -y \
&& apt-get clean
RUN pip3 --no-cache-dir install \
mlflow==1.14.0 \
psycopg2~=2.8.6 \
boto3
RUN apt-get autoremove -y gcc
RUN mkdir /mlflow/
WORKDIR /mlflow
EXPOSE 8001
CMD mlflow server \
--host 0.0.0.0 \
--port 8001 \
--backend-store-uri "postgresql+psycopg2://{username}:{password}@{hostname}:5432/mlflowdb" \
--default-artifact-root "s3://bucket-eb84c6b0/"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.