#1 Create the below docker file
#2 Create the dependency files
package.jsonindex.js
package.json
index.js
#3 Build the container
Build the container from the location where all the above 3 files are placed.docker build -t testdocker/myfirstweb:v1 .
#4 Port binding
Through the index.js file, we have configured nodeJS to listen to port 8080 i.e; the port 8080 on the container has the app deployed.To access this port from the local machine, there should be a binding from local machine to docker container, so as to allow the web browser on local machine to access the port 8080 of docker container.
This is done with the help of docker run command.
syntax: docker run -p 8080:8080 testdocker/myfirstweb:v1
#5 Access the test Url from web browser
http://localhost:8080
this should print the message
Hello My First Web App Container