簡體   English   中英

使用nodeJS 4創建ubuntu docker鏡像

[英]Create ubuntu docker image with nodeJS 4

我需要使用nodeJS 4創建一個ubuntu docker鏡像。我正在做的是這樣的:

FROM ubuntu:16.04

RUN apt-get update -y && \
    apt-get install -yqq python build-essential apt-transport-https ca-certificates curl locales nodejs npm sudo git

RUN curl -sL https://deb.nodesource.com/setup_4.x | bash -
RUN update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10

但這有道理嗎? 安裝apt-get install nodejs npmcurl -sL https://deb.nodesource.com/setup_4.x | bash - curl -sL https://deb.nodesource.com/setup_4.x | bash -

而且我還必須做update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10

我想使它更小,更智能。

這是我在Debian Jessie容器中安裝nodejs的方法:

COPY ./rsrc/nodesource.gpg.key /tmp/nodesource.gpg.key
RUN apt-key add /tmp/nodesource.gpg.key
RUN echo 'deb https://deb.nodesource.com/node_6.x jessie main' > /etc/apt/sources.list.d/nodejs.list
RUN apt-get update
RUN apt-get install -y nodejs

我認為在此處將正式回購列表添加到apt是最好的選擇。

編輯:

前兩行將crypto nodesource密鑰添加到apt(以后用於加密驗證pkg),然后將節點列表添加到apt列表中,更新並安裝您的節點軟件包

編輯²:

另外,將專用的默認用戶添加到您的節點映像中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM