代码之家  ›  专栏  ›  技术社区  ›  arthurakay

在Kali Linux docker映像上安装NodeJS时出现问题

  •  -4
  • arthurakay  · 技术社区  · 7 年前

    我正在尝试创建一个基于kalilinux基本映像的docker映像,并且需要安装NodeJS作为我的应用程序的依赖项。

    这是我的文件:

    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"]
    

    但是,我在尝试安装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
    

    kali-linux-all 元包,但NodeJS/npm似乎不存在。

    我只是误解了Docker和/或Kali Linux的一些基本前提吗?有没有其他方法可以将NodeJS安装到我的容器中?

    1 回复  |  直到 7 年前
        1
  •  0
  •   arthurakay    7 年前

    我仍然不完全明白为什么NodeJS安装在我的VM上,而不是安装在Kali docker的基本映像上。。。但无论如何,我还是设法打开了我自己。

    rpm --我发现一个不同的脚本没有它也能工作。然而,新的脚本也需要我安装 gnupg

    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"]
    
    推荐文章