I am trying to install python, nodejs and npm inside an ubuntu image and I get the following error
125.4 debconf: Perl may be unconfigured (Debconf/Log.pm did not return a true value at (eval 1) line 4.
125.4 BEGIN failed--compilation aborted at (eval 1) line 4.
125.4 ) -- aborting
125.4 Fetched 242 MB in 1min 55s (2107 kB/s)
125.4 dpkg: error: corrupt info database format file '/var/lib/dpkg/info/format'
125.4 E: Sub-process /usr/bin/dpkg returned an error code (2)
------
Dockerfile:9
--------------------
8 | # Install required packages
9 | >>> RUN apt update &&
10 | >>> apt install -y curl python3 python3-pip nodejs npm &&
11 | >>> rm -rf /var/lib/apt/lists/*
12 |
--------------------
ERROR: failed to solve: process "/bin/sh -c apt update && apt install -y curl python3 python3-pip nodejs npm && rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100
I don’t know what is causing the error.
Here is the DockerFile
# Use the ubuntu:latest base image
FROM ubuntu:latest
LABEL authors="bunty"
#ENV DEBIAN_FRONTEND=noninteractive
# Install required packages
RUN apt update &&
apt install -y curl python3 python3-pip nodejs npm &&
rm -rf /var/lib/apt/lists/*
# Set the working directory inside the container
WORKDIR /engine_api
# Copy the entire current directory (including subdirectories) to /engine_api in the container
COPY ./api/src /engine_api
COPY ./package.json ./package-lock.json /engine_api/
COPY ./my_engine_data/ ./my_engine_data
COPY ./public ./public
# Install Node.js dependencies
RUN npm install &&
chmod -R +x ./my_engine_data/packages
RUN pip3 install numpy scipy pandas seaborn matplotlib scikit-learn
# Install the R package 'runit'
RUN R -e "install.packages('runit', dependencies=TRUE, repos='https://cran.rstudio.com/')"
# Set the command to run.sh the Node.js application
CMD node /engine_api/app.js
I am using docker in a MACBOOK air 2022.
2
Answers
You have to install
apt-transport-https
packages before the error line.Try this line just before the installation
You seem to be missing
apt-transport-https
— you can fix that with the following on line 9 of yourDockerfile
: