无法在带有Windows的Docker容器内安装pip软件包

问题描述 投票:0回答:1

Dockerfile

# Use an official Python runtime as a base image
FROM python:3.8.1-windowsservercore

# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app
ADD . /app

# Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt

# Make port 80 available to the world outside this container
EXPOSE 80

# Define environment variable
ENV NAME World

# Run app.py when the container launches
CMD ["python", "app.py"]

它给我这个错误

Error

如何解决此代理网络错误?我有针对Linux的解决方案,但对于Windows 10,我找不到任何答案。我正在使用Windows的最新docker。

windows docker dockerfile docker-for-windows
1个回答
0
投票
  • 如果您在两次使用之间没有n / w代理,请使用以下命令:docker build --no-cache --build-arg HTTP_PROXY =http://xx.xx.xx.xx:xx--build-arg HTTPS_PROXY =http://xx.xx.xx.xx:xx--network = host -t helloworkapp。
  • 如果您没有任何代理,请使用此命令(使用主机n / w下载软件包):
  • docker build --no-cache --network = host -t helloworkapp。
© www.soinside.com 2019 - 2024. All rights reserved.