-5

I am trying to create a docker image based on the Kali Linux base image, and I need to install NodeJS as a dependency for my application.

Here's my Dockerfile:

FROM kalilinux/kali-linux-docker

RUN apt-get update -y && \
    apt-get dist-upgrade -y && \
    apt-get autoremove -y && \
    apt-get clean -y

RUN apt-get install curl -y

RUN curl --silent --location https://rpm.nodesource.com/setup_8.x | bash - \
    && apt-get install nodejs -y

RUN npm i -g npm

ENV NODE_ENV production

WORKDIR /root/app
COPY . .

RUN npm i

EXPOSE 4000
ENTRYPOINT ["npm", "start"]

However, I hit the following error trying to install NodeJS:

Step 4/11 : RUN curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -     && apt-get install nodejs -y
 ---> Running in a63e56802eba

## Installing the NodeSource Node.js 8.x LTS Carbon repo...


## Inspecting system...


## You don't appear to be running an Enterprise Linux based system,
please contact NodeSource at https://github.com/nodesource/distributions/issues
if you think this is incorrect or would like your distribution to be considered
for support.

The command '/bin/sh -c curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -     && apt-get install nodejs -y' returned a non-zero code: 1

Admittedly I'm confused by a few things... namely that I was under the impression that NodeJS was already installed on Kali Linux (I have a VirtualBox VM using Debian 64-bit where it exists). I went as far as trying to install the kali-linux-all metapackage, but NodeJS/npm don't seem to exist.

Am I simply misunderstanding some basic premise of Docker and/or Kali Linux? Is there any other way to install NodeJS into my container?

arthurakay
  • 5,631
  • 8
  • 37
  • 62
  • Not to be argumentative, but isn't configuring Docker containers a programming/development question? Based on the negative downvotes and lack of answers I'm sure another site may have been more helpful, but I don't really agree that this is off topic. FWIW I also think my question is "Minimal, Complete, and Verifiable" - the code works exactly as posted and I accurately describe my problem. – arthurakay Jan 30 '19 at 13:57
  • 1
    I believe the Docker tag exists for the Docker API. Programming against the Docker API is certainly on-topic. Docker is just another lightweight VM like chroots. Neither are primarily programming or development related. They are something developers use on occasion. I ask my Docker and chroot questions on [Unix & Linux Stack Exchange](http://unix.stackexchange.com/). I think the down votes are due to the Kali tag. Nearly every Kali question is off-topic and those questions get hit hard nowadays. (In case it matters... I did not cast a down vote. I don't believe in piling them on). – jww Jan 30 '19 at 14:13
  • Thanks for the clarification, I'll keep all of that in mind moving forward! – arthurakay Jan 30 '19 at 15:40

1 Answers1

0

I still don't fully understand why NodeJS is installed on my VM but not the base Kali docker image... but in any case I did manage to unblock myself.

First, I was pulling down a NodeJS installation script from nodesource which required rpm -- I found a different script that works without it. However the new script also required that I install gnupg.

Here's my updated Dockerfile:

FROM kalilinux/kali-linux-docker

RUN apt-get update -y && \
    apt-get dist-upgrade -y && \
    apt-get autoremove -y && \
    apt-get clean -y

RUN apt-get -y install curl gnupg

RUN curl --silent --location https://deb.nodesource.com/setup_8.x | bash - \
    && apt-get install nodejs -y

RUN npm i -g npm

ENV NODE_ENV production

WORKDIR /root/app
COPY . .

RUN npm i

EXPOSE 4000
ENTRYPOINT ["npm", "start"]
arthurakay
  • 5,631
  • 8
  • 37
  • 62