I am new to Docker. We have a node based REST service and I am trying to create a docker image so that I can easily deploy the service on build agents. I have CD to the folder where we have the package.json of the service and added below docker file. I am on Win 10 build 14xxxxx and using Docker windows container. Do I need to pull a node image and install it on nanoserver first ?
FROM microsoft/nanoserver
# Create app directory
RUN powershell New-Item -ItemType directory -Path \usr\src\app
WORKDIR \usr\src\app
# Install app dependencies
COPY package.json \usr\src\app
RUN npm install
# Bundle app source
COPY . \usr\src\app
EXPOSE 8080
CMD [ "npm", "start" ]
When I run
docker build -t mycompany/node-engine
I am getting below error
'npm' is not recognized as an internal or external command,
operable program or batch file.
Below is the full output
Sending build context to Docker daemon 24.67 MB
Step 1/8 : FROM microsoft/nanoserver
---> a943c29f0046
Step 2/8 : RUN powershell New-Item -ItemType directory -Path \usr\src\app
---> Using cache
---> f1df2109ddd6
Step 3/8 : WORKDIR \usr\src\app
---> Using cache
---> 66d552a76612
Step 4/8 : COPY package.json \usr\src\app
---> Using cache
---> fcf9663854c3
Step 5/8 : RUN npm install
---> Running in b47b47ad1439
'npm' is not recognized as an internal or external command,
operable program or batch file.
The command 'cmd /S /C npm install' returned a non-zero code: 1