我正在嘗試構(gòu)建一個(gè) Docker 容器,我想在其中安裝一些 Python 模塊pip(最終將需要這些模塊來(lái)構(gòu)建應(yīng)用程序)。我寫了以下內(nèi)容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!" ]構(gòu)建 ( docker build -t app:0 .)時(shí),我得到以下輸出: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 中刪除第二個(gè)調(diào)用,則容器似乎已成功構(gòu)建。任何人都可以幫我理解是什么觸發(fā)了構(gòu)建錯(cuò)誤?提前謝謝了!
在`docker build`期間使用`pip`安裝python模塊失敗
繁華開滿天機(jī)
2021-07-23 16:08:02