Reputation: 11
I am working with Docker, and I have created a JavaScript file that prints "Hello World." I have successfully built the docker image "hello-world". But, when I do this:
**User\user\Desktop> docker build -t hello-world .**
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 31B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/nginx:latest 4.3s
=> [internal] load build context 0.0s
=> => transferring context: 56B 0.0s
=> [1/3]FROM docker.io/library/nginx:latest@sha256:2275af0f20d71b293916f1958f8497f987b8d8fd8113df54635f2a5915002bf1 0.0s
=> CACHED [2/3] COPY . /app 0.0s
=> CACHED [3/3] WORKDIR /app 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:1eb1ae4c9b1bf5b7e0c8ccbb24756838f4559ae80c109140efdd942fbf72bb54 0.0s
=> => naming to docker.io/library/hello-world 0.0s
**User\user\desktop> docker run hello-world**
/bin/sh: 1: node: not found`
Please look below to view the issue.
Upvotes: 0
Views: 931
Reputation: 1953
You are using the image of nginx webserver which does not have nodejs installed. A docker Image containing Nodejs would be more suitable for you. If you want to use nginx Container you have to build your webapp first and copy the build artifacts into the nginx container.
Upvotes: 1