Docker への入門の一環として、自分で Dockerfile を作成し、それを使って Node.js アプリを Docker Container で動かしてみる。 Hello World Dockerfile を使うことで、既存の Docker Image を編集して新しい Docker Image を作ることができる。 具体的には、Dockerfileという名前のファイルにコマンドを記述していくことで、その内容に基づいた Docker Image を作成できるようになる。 例えば以下の Dockerfile では、FROMとCMDというコマンドを使っている。これらのコマンドの意味は後述する。 FROM node:16 CMD [ "echo", "Hello World" ] カレントディレクトリに上記のDockerfileがある状態で% docker build -t sample