为了账号安全,请及时绑定邮箱和手机立即绑定

在`docker build`期间使用`pip`安装python模块失败

在`docker build`期间使用`pip`安装python模块失败

繁华开满天机 2021-07-23 16:08:02
我正在尝试构建一个 Docker 容器,我想在其中安装一些 Python 模块pip(最终将需要这些模块来构建应用程序)。我写了以下内容Dockerfile:FROM ubuntu:16.04RUN echo "===> Adding prerequisites..."   && \    apt update -y            && \    DEBIAN_FRONTEND=noninteractive  \        apt install --no-install-recommends -y -q  \                build-essential                        \                python python-pip python-dev           && \    pip install --upgrade setuptools pip wheel      && \    pip install --upgrade pyyaml# Default commandCMD [ "echo", "Hello!" ]构建 ( docker build -t app:0 .)时,我得到以下输出:Sending build context to Docker daemon  10.26MBStep 1/3 : FROM ubuntu:16.04 ---> 4a689991aa24Step 2/3 : RUN echo "===> Adding prerequisites..."   &&     apt update -y            &&     DEBIAN_FRONTEND=noninteractive          apt install --no-install-recommends -y -q                  build-essential                                        python python-pip python-dev           &&     pip install --upgrade setuptools pip wheel      &&     pip install --upgrade pyyaml ---> Running in 9d813b5bc68d===> Adding prerequisites...WARNING: apt does not have a stable CLI interface. Use with caution in scripts.Get:1 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB][More apt output, no errors here]Get:18 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [8532 B]Fetched 15.5 MB in 1s (11.3 MB/s)Reading package lists...Building dependency tree...Reading state information...All packages are up to date.WARNING: apt does not have a stable CLI interface. Use with caution in scripts.但是,如果我pip从 Dockerfile 中删除第二个调用,则容器似乎已成功构建。任何人都可以帮我理解是什么触发了构建错误?提前谢谢了!
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 609 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信