skip to Main Content

I am trying to install the python 2 through my dockerfile but getting the following error.

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

Here I am trying to install the python2 and some of my docker steps are given below.

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

In python2 installation steps the processing is existing with the above error. Can anybody help me to resolve the issue.

2

Answers


  1. change from

    RUN apt install python2
    

    to

    RUN apt install -y python2
    
    Login or Signup to reply.
  2. As @anemyte suggests (in a comment on the question), use apt-get instead of just apt.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search