构建 docker 镜像时出错

时间:2021-07-09 07:49:58

标签: python docker ubuntu

我正在尝试通过我的 python 2 安装 dockerfile,但出现以下错误。

Step 10/58 : RUN apt install python2
 ---> Running in d08c8eb21a67

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib python2-minimal
  python2.7 python2.7-minimal
Suggested packages:
  python2-doc python-tk python2.7-doc binfmt-support
The following NEW packages will be installed:
  libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib python2
  python2-minimal python2.7 python2.7-minimal
0 upgraded, 7 newly installed, 0 to remove and 8 not upgraded.
Need to get 3816 kB of archives.
After this operation, 16.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.
The command '/bin/sh -c apt install python2' returned a non-zero code: 1

这里我正在尝试安装 python2,下面给出了我的一些 docker 步骤。

<块引用>

Dockerfile:

FROM ubuntu:20.04


RUN apt-get update

# SET TZ
RUN apt-get install -y tzdata
RUN echo 'Asia/Kolkata' > /etc/timezone
RUN dpkg-reconfigure --frontend noninteractive tzdata

# System tools
RUN apt-get install -y --no-install-recommends libatlas-base-dev gfortran nginx supervisor
RUN apt install -y curl wget

# JAVA 11
RUN apt-get install -y openjdk-11-jdk

# BUILD tools
RUN apt-get install -y maven

# Python2

RUN apt install python2

# NodeJS
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs

在python2安装步骤中,处理存在上述错误。谁能帮我解决这个问题。

1 个答案:

答案 0 :(得分:1)

更改自

RUN apt install python2

RUN apt install -y python2