Can't install latest version of rpm using docker

Hello
I have the following Docker lines :

# Version of golang is specified in the gitlab-ci.yml file

FROM centos:latest

ARG GOLANG_VERSION

ARG GOLANG_VERSION_CHECKSUM

ARG GOLANGCI_LINT_VERSION

# The SED stuff disables/enables repositories for CENTOS updates.

RUN cd /etc/yum.repos.d/ && \

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \

sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* && \

yum update -y && \

yum upgrade -y && \

yum install -y epel-release

RUN yum install -y wget \

gcc-c++ \

make \

git \

zip

RUN curl –sL https://rpm.nodesource.com/setup_10.x

RUN yum install -y nodejs \

npm nodejs && ls -al

If I execute this I will get npm version 6.14.11.
On my local I am working with the 9.6.7 version

How can I get the latest npm version from Docker (FROM CENTOS) ?

Thank you for the help !

Use 3 backticks in front and after code/config to make it correctly readable.

I changed the code

FROM centos:latest

ARG GOLANG_VERSION
ARG GOLANG_VERSION_CHECKSUM
ARG GOLANGCI_LINT_VERSION


# The SED stuff disables/enables repositories for CENTOS updates.
RUN cd /etc/yum.repos.d/ && \
	sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \
	sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* && \
	yum update -y && \
	yum upgrade -y && \
	yum install -y epel-release

RUN yum install -y wget \
	gcc-c++ \
	make \
	git \
	zip
SHELL ["/bin/bash", "--login", "-c"]
RUN yum clean all
RUN yum install -y	curl
RUN yum install -y 	gcc-c++
# Replace shell with bash so we can source files
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 20
RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.20.0/install.sh | bash
RUN source ${NVM_DIR}/nvm.sh && nvm install ${NODE_VERSION} && nvm use ${NODE_VERSION}
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH      $NVM_DIR/v$NODE_VERSION/bin:$PATH

However I am getting this error :

Checksums empty
mv: cannot move '/usr/local/nvm/bin/node-v20.15.0-linux-x64' to '/usr/local/nvm/versions/v20.15.0': No such file or directory
Binary download failed, trying source.
nvm: install v20.15.0 failed!
error building image: error building stage: failed to execute command: waiting for process to exit: exit status 1

Can anyone help ?

Thanx

Can you explain what you want to achieve? Why not use an official node image?

It seems the CentOS image (link) hasn’t been updated since 2020 :sweat_smile: