LoginSignup
10
12

More than 5 years have passed since last update.

[Docker] Node.js以外のコンテナに追加でNode.jsの最新版をインストールするDockerfileの記述

Last updated at Posted at 2017-12-02

Node.jsをメインで使う場合は公式のイメージを使えばOK。
https://hub.docker.com/_/node/

他の言語のイメージに、Node.jsを追加したい場合

apt-get update
apt-get install nodejs

でも良いが、これだと最新版ではないケースが多いので
任意のバージョンを取得したい場合は以下の記述にする。

RUN curl -SL https://deb.nodesource.com/setup_{Node.jsのメジャーバージョン}.x | bash
RUN apt-get install -y nodejs

https://deb.nodesource.com/setup_{Node.jsのバージョン}.x
は公式が提供しているインストール用スクリプト
https://github.com/nodesource/distributions

10
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
12