I am trying to install the python version 3.8.5 on the base nginx image on the Dockerfile and getting the error message. Could you please help me to resolve the issue?
FROM nginx
RUN apt-get update && \
apt-get install -y \
wget \
make \
gcc \
xxd \
curl \
libcap2-bin \
zlib1g-dev \
&& apt-get clean
RUN wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz \
&& tar -xvf Python-3.8.5.tgz && cd Python-3.8.5 \
&& ./configure --enable-shared \
&& make \
&& make test \
&& make install
Output:
FAILED (errors=1, skipped=94)
tests failed again:
test_asyncio test_socket
My Dockerfile-php file is failing (GCP build) at the following line, as of this morning (no changes were made to GCP/code relating to containers at all):
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.8/main' >> /etc/apk/repositories \
&& apk add --no-cache \
autoconf \
bzip2-dev \
curl \
ffmpeg \
glib \
g++ \
icu-dev \
libcrypto1.0 \
libgcc \
libintl \
libzip-dev \
libmemcached-dev \
libssl1.0 \
libstdc++ \
libxext \
libxml2-dev \
libxrender \
libx11 \
make \
nodejs \
nodejs-npm \
supervisor \
ttf-dejavu \
ttf-droid \
ttf-freefont \
ttf-liberation \
ttf-ubuntu-font-family \
&& docker-php-ext-install -j$(nproc) bcmath bz2 intl mbstring opcache pcntl pdo_mysql soap sockets zip \
&& pecl install memcached \
&& docker-php-ext-enable memcached \
&& wget https://storage.googleapis.com/proteus/wkhtmltopdf -O /usr/local/bin/wkhtmltopdf \
&& chmod +x /usr/local/bin/wkhtmltopdf \
&& ( \
cd /tmp \
&& curl -Ls https://storage.googleapis.com/masterstart-platform/files/newrelic-php5-8.7.0.242-linux-musl.tar.gz -o newrelic.tar.gz \
&& tar -xzf newrelic.tar.gz \
&& cd newrelic-* \
&& ./newrelic-install install \
&& cd /tmp \
&& rm newrelic.tar.gz \
) \
&& npm install -g mjml \
&& apk del \
autoconf \
curl \
g++ \
make
GCP Error:
npm WARN npm npm does not support Node.js v14.17.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-06-29T10_08_11_471Z-debug.log
The command '/bin/sh -c echo 'http://dl-cdn.alpinelinux.org/alpine/v3.8/main' >> /etc/apk/repositories && apk add --no-cache autoconf bzip2-dev curl ffmpeg glib g++ icu-dev libcrypto1.0 libgcc libintl libzip-dev libmemcached-dev libssl1.0 libstdc++ libxext libxml2-dev libxrender libx11 make nodejs nodejs-npm supervisor ttf-dejavu ttf-droid ttf-freefont ttf-liberation ttf-ubuntu-font-family && docker-php-ext-install -j$(nproc) bcmath bz2 intl mbstring opcache pcntl pdo_mysql soap sockets zip && pecl install memcached && docker-php-ext-enable memcached && wget https://storage.googleapis.com/proteus/wkhtmltopdf -O /usr/local/bin/wkhtmltopdf && chmod +x /usr/local/bin/wkhtmltopdf && ( cd /tmp && curl -Ls https://storage.googleapis.com/masterstart-platform/files/newrelic-php5-8.7.0.242-linux-musl.tar.gz -o newrelic.tar.gz && tar -xzf newrelic.tar.gz && cd newrelic-* && ./newrelic-install install && cd /tmp && rm newrelic.tar.gz ) && npm install -g mjml && apk del autoconf curl g++ make' returned a non-zero code: 1
So looks like I need to use a later version of npm (the versions it's listing as supporting are way below what nodejs is currently at) ...
What is puzzling is in the Dockerfile-php the nodejs package is not specified to be an older version so shouldn't this be referencing the latest nodejs package? How to know which nodejs is being added by apk?
I'm not the author of this docker file and fairly new to Docker containers) any help much appreciated!
Turns out this has caused a break in this:
https://gitlab.alpinelinux.org/alpine/aports/-/commit/25b10bd1a93e12a7e49fee38b0a229281ae49fb7
I'm making a Dockerfile to install python38 on centos7 base. Everything works file until pip3 command. Dockerile looks like this.
FROM centos:centos7
RUN RPM_LIST=" \
gcc \
make \
openssl-devel \
bzip2-devel \
libffi-devel" && \
yum install -y $RPM_LIST && \
curl -O https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tgz && \
tar xvf Python-3.8.2.tgz && \
cd Python-3.8.2 && \
./configure && \
make && \
make install && \
rm -rf /Python-3.8.2* && \
yum remove -y $RPM_LIST && \
pip3 install retrying
Error is The folder you are executing pip from can no longer be found..
I changed the last line to RUN pip3 install retrying and it started working, but it added an additional 300 MB to my image, which i can't effort.
Any suggestions, what am i missing here or any alternative ways ?
This is how the working Dockerfile looks like
FROM centos:centos7
RUN RPM_LIST=" \
gcc \
make \
openssl-devel \
bzip2-devel \
libffi-devel" && \
yum install -y $RPM_LIST && \
curl -O https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tgz && \
tar xvf Python-3.8.2.tgz && \
cd Python-3.8.2 && \
./configure && \
make && \
make install && \
pip3 install retrying && \
yum remove -y $RPM_LIST && \
rm -rf /Python-3.8.2*
for some reason, calling pip3 command from Python-3.8.2 folder was not working. Here i moved the rm command after the pip3 call. Hope this information helps someone.
I just ran into The folder you are executing pip from can no longer be found.
My Dockerfile has not changed in months. It does not install pip.
It does force remove and make a folder just prior to running a pip install on a requirements file -- into which pip is supposed to install things.
The fix? I simply ran it again and it worked. Hmm...
So I am posting this here in case there is some mysterious timing issue about which folks wish to collect clues.
--- edit add --
Also, yesterday I ran into this docker issue, which required turning off docker's experimental gRPC feature in its preferences. Perhaps it could be related somehow?
Why does Serverless produce an Invalid Cross-device link Error when trying to package or deploy?
we are using gitlab ci/cd to integrate and deploy our projects,whenever we want to deploy our project into dev,stg,prod environments, we create fresh docker container and install all the dependencies/requirements for the project and then will deploy the code.... in this process when we run usual script, to install dependency packages and requirements we are getting the following error:
UnsatisfiableError: The following specifications were found to be incompatible with each other: - pip -> python[version='>=3.7,<3.8.0a0']
FROM python:3.6
RUN apt-get update && apt-get install --fix-missing -y \
lsof \
man \
cmake \
nano \
supervisor \
net-tools \
pv \
multitail \
bsdmainutils \
blender \
texlive-base \
texlive-latex-base \
texlive-latex-recommended \
texlive-latex-extra \
xmlsec1 \
libgl1-mesa-glx
RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-
x86_64.sh \
&& bash Miniconda3-latest-Linux-x86_64.sh -bfp \
&& rm Miniconda3-latest-Linux-x86_64.sh
ENV PATH="/root/miniconda3/bin:${PATH}"
RUN conda install -n base conda -y \
&& conda install -c conda-forge -c dlr-sc -c pythonocc -c oce -c jf
pythonocc-core -y
I am user of AWS elastic beanstalk, and I have a little problem. I want to build my CSS files with less+node. But I don`t know how to install node in my dockerfile, when building with jenkins.
Here is installation packages what I am using in my docker. I will be glad for any suggestions.
FROM php:5.6-apache
# Install PHP5 and modules along with composer binary
RUN apt-get update
RUN apt-get -y install \
curl \
default-jdk \
git \
libcurl4-openssl-dev \
libpq-dev \
libmcrypt-dev \
libpq5 \
npm \
node \
zlib1g-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install curl json mbstring opcache pdo_mysql zip gd exif sockets mcrypt
# Install pecl
RUN pecl install -o -f memcache-beta \
&& rm -rf /tmp/pear \
&& echo 'extension=memcache.so' > /usr/local/etc/php/conf.d/memcache.ini
After this I am runing my entrypoint.sh with code
#!/usr/bin/env sh
composer run-script post-install-cmd --no-interaction
chmod 0777 -R /var/app/app/cache
chmod 0777 -R /var/app/app/logs
exec apache2-foreground
But then I`ve got this error
Error Output: [2016-04-04 11:23:44] assetic.ERROR: The template ":tmp:module.html.twig" contains an error: A template that extends another one cannot have a body in ":tmp:module.ht
ml.twig" at line 7.
But when I install inside the Docker container node this way
apt-get install git-core curl build-essential openssl libssl-dev
git clone https://github.com/nodejs/node.git
cd node
./configure
make
sudo make install
node -v
I can build my CSS. So question is..how this installation above make install inside my Dockerfile when I am building it with Jenkins?
I think this works slightly better.
ENV NODE_VERSION=16.13.0
RUN apt install -y curl
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN node --version
RUN npm --version
Note that nvm is a version manager for node.js, designed to be installed per-user, and invoked per-shell. nvm works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: unix, macOS, and windows WSL.
Running apt-get install node does not install Node.js, because that's not the package you're asking for.
If you run apt-cache info node you can see that what you are installing is a "Amateur Packet Radio Node program (transitional package)"
You should follow the Node.js install instructions to install via package manager.
Or if you like building from git, you can just do that inside Docker:
RUN apt-get install -y git-core curl build-essential openssl libssl-dev \
&& git clone https://github.com/nodejs/node.git \
&& cd node \
&& ./configure \
&& make \
&& sudo make install
According to the following answer, I would suggest using npm via the n package, that lets you choose the nodejs version, or use the latest tag or the lts tag. For example for latest:
RUN apt-get update && apt-get install -y \
software-properties-common \
npm
RUN npm install npm#latest -g && \
npm install n -g && \
n latest
Just 2 lines
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install -y nodejs
Get the node image and put it at the top of your dockerfile:
FROM node:[tag_name] AS [alias_name]
Verify the version by adding following code:
RUN echo "NODE Version:" && node --version
RUN echo "NPM Version:" && npm --version
Then add the following code every time you need to use nodejs in a container:
COPY --from=[alias_name] . .
From the codes above, replace the following with:
[tag_name] - the tag value of the node image you want to use. Visit https://hub.docker.com/_/node?tab=tags for the list of available tags.
[alias_name] - your preferred image name to use in your dockerfile.
Example:
FROM node:latest AS node_base
RUN echo "NODE Version:" && node --version
RUN echo "NPM Version:" && npm --version
FROM php:5.6-apache
COPY --from=node_base . .
### OTHER CODE GOES HERE
Binary download without any compilation
FROM ubuntu
RUN apt-get update && apt-get install -y \
ca-certificates \
curl
ARG NODE_VERSION=14.16.0
ARG NODE_PACKAGE=node-v$NODE_VERSION-linux-x64
ARG NODE_HOME=/opt/$NODE_PACKAGE
ENV NODE_PATH $NODE_HOME/lib/node_modules
ENV PATH $NODE_HOME/bin:$PATH
RUN curl https://nodejs.org/dist/v$NODE_VERSION/$NODE_PACKAGE.tar.gz | tar -xzC /opt/
# comes with npm
# RUN npm install -g typescript
I am using following Dockerfile to setup node version 8.10.0.
Here I have used NVM (Node Version Manager ), so we can choose which node version should be installed on that container. Please use absolute path of npm when installing node modules (eg: /root/.nvm/versions/node/v${NODE_VERSION}/bin/npm install leasot#latest -g)
FROM ubuntu:18.04
ENV NODE_VERSION=8.10.0
RUN apt-get update && \
apt-get install wget curl ca-certificates rsync -y
RUN wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
RUN cp /root/.nvm/versions/node/v${NODE_VERSION}/bin/node /usr/bin/
RUN cp /root/.nvm/versions/node/v${NODE_VERSION}/bin/npm /usr/bin/
RUN /root/.nvm/versions/node/v${NODE_VERSION}/bin/npm install leasot#latest -g
Note: This is a cropped Dockerfile.
The short answer, for example, install v14.17.1
ENV PATH="/opt/node-v14.17.1-linux-x64/bin:${PATH}"
RUN curl https://nodejs.org/dist/v14.17.1/node-v14.17.1-linux-x64.tar.gz |tar xzf - -C /opt/
list of all available versions can be found here -> https://nodejs.org/dist/
Directly into /usr/local so it's already in your $PATH
ARG NODE_VERSION=8.10.0
RUN curl https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz | tar -xz -C /usr/local --strip-components 1
The accepted answer gives the link to the installation instructions for all systems, but it won't run out of the box since you often (e.g. for ubuntu) don't have all required dependencies installed (namely curl and sudo).
So here's for example how you'd do it for ubuntu:
FROM ubuntu
# Core dependencies
RUN apt-get update && apt-get install -y curl sudo
# Node
# Uncomment your target version
# RUN curl -fsSL https://deb.nodesource.com/setup_10.x | sudo -E bash -
# RUN curl -fsSL https://deb.nodesource.com/setup_12.x | sudo -E bash -
# RUN curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
# RUN curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
RUN sudo apt-get install -y nodejs
RUN echo "NODE Version:" && node --version
RUN echo "NPM Version:" && npm --version
then build with
docker build . --progress=plain
to see the output of the echo statements. Of course you could also leave away the echo statements and run it regularly with docker build ., after you've made sure everything is working as intended.
You can also leave away the installation of sudo, but then you'll have to get rid of the sudo occurrences in the script.
FROM ubuntu:20.04
# all necessaries for next RUN
RUN set -e; \
apt-get update && \
apt-get install -qqy --no-install-recommends \
curl wget nano gnupg2 software-properties-common && \
rm -rf /var/lib/apt/lists;
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
# uncomment for checking versions
# Step 4/10 : RUN apt-cache show nodejs | grep Version;return 1;
# ---> Running in xxxxxxxxx
# Version: 14.18.2-deb-1nodesource1
# Version: 10.19.0~dfsg-3ubuntu1
#RUN apt-cache show nodejs | grep Version;return 1;
RUN set -e; \
apt-get update && \
apt-get install -qqy \
nodejs && \
rm -rf /var/lib/apt/lists;
# uncomment for check
# RUN node -v