Create a Dockerfile for a simple Node.js application that serves “Hello World” on port 3000.
Question
Create a Dockerfile for a simple Node.js application that serves “Hello World” on port 3000. Build the Docker image with tag my-node-app and run a container. Below is the sample index.js file.
Tag the Docker image my-node-app
from Task 3 with a version tag v1.0.0
.
Solution
Dockerfile
Build the image
Push the image to Docker Hub
Then build the image with your repo name, For eg, `syedjaferkhub`
PreviousPull the nginx image from Docker Hub and run it as a container. Map port 80 of the container to portNextRun a container from the ubuntu image and start an interactive shell session inside it.
Last updated