docker - 由于高山错误,docker无法构建
问题描述
嗨,我正在尝试构建一个 docker,Docker 文件看起来像这样。
FROM alpine
LABEL description "Nginx + uWSGI + Flask based on Alpine Linux and managed by Supervisord"
# Copy python requirements file
COPY requirements.txt /tmp/requirements.txt
RUN apk add --no-cache \
python3 \
bash \
nginx \
uwsgi \
uwsgi-python3 \
supervisor && \
python3 -m ensurepip && \
rm -r /usr/lib/python*/ensurepip && \
pip3 install --upgrade pip setuptools && \
pip3 install -r /tmp/requirements.txt && \
rm /etc/nginx/conf.d/default.conf && \
rm -r /root/.cache
# Copy the Nginx global conf
COPY nginx.conf /etc/nginx/
# Copy the Flask Nginx site conf
COPY flask-site-nginx.conf /etc/nginx/conf.d/
# Copy the base uWSGI ini file to enable default dynamic uwsgi process number
COPY uwsgi.ini /etc/uwsgi/
# Custom Supervisord config
COPY supervisord.conf /etc/supervisord.conf
# Add demo app
COPY ./app /app
WORKDIR /app
CMD ["/usr/bin/supervisord"]
错误看起来像
Sending build context to Docker daemon 250.9kB
Step 1/11 : FROM alpine
---> 196d12cf6ab1
Step 2/11 : LABEL description "Nginx + uWSGI + Flask based on Alpine Linux and managed by Supervisord"
---> Using cache
---> d8d38c761b8d
Step 3/11 : COPY requirements.txt /tmp/requirements.txt
---> Using cache
---> cb29eb34ca46
Step 4/11 : RUN apk add --no-cache python3 bash nginx uwsgi uwsgi-python3 supervisor && python3 -m ensurepip && rm -r /usr/lib/python*/ensurepip && pip3 install --upgrade pip setuptools && pip3 install -r /tmp/requirements.txt && rm /etc/nginx/conf.d/default.conf && rm -r /root/.cache
---> Running in 3d568d2620dd
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz: could not connect to server (check repositories file)
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz: could not connect to server (check repositories file)
ERROR: unsatisfiable constraints:
bash (missing):
required by: world[bash]
nginx (missing):
required by: world[nginx]
python3 (missing):
required by: world[python3]
supervisor (missing):
required by: world[supervisor]
uwsgi (missing):
required by: world[uwsgi]
uwsgi-python3 (missing):
required by: world[uwsgi-python3]
The command '/bin/sh -c apk add --no-cache python3 bash nginx uwsgi uwsgi-python3 supervisor && python3 -m ensurepip && rm -r /usr/lib/python*/ensurepip && pip3 install --upgrade pip setuptools && pip3 install -r /tmp/requirements.txt && rm /etc/nginx/conf.d/default.conf && rm -r /root/.cache' returned a non-zero code: 6
一个月前它正在建设中。由于对 Docker 的了解有限,我无法弄清楚导致错误的原因。一个快速的谷歌搜索产生了这两个链接:link1 link2但他们都没有工作。
解决方案
使用标志“--network host”构建 docker 解决了这个问题。这是链接。
推荐阅读
- python - NLTK Punkt Tokenizer:如何自定义句尾字符?
- laravel - 渴望加载媒体网址 - laravel-medialibrary
- python - 同一组内的时间戳差异
- django - 使用 python 3.8 在 Windows 10 上安装 django 频道和扭曲的问题
- angular - 什么是等价的承诺
在可观察的? - java - 当我尝试共享文件时,它的节目格式不支持味精
- javascript - 影响未链接到它的 div 的脚本
- javascript - JavaScript 函数
- ruby - 如何在 RUBY 中将字符串转换为整数?
- php - 即使在laravel中生成密钥后,“没有指定应用程序加密密钥”错误?