Skip to content

Latest commit

 

History

History

006-nodejs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Instruction that is used to build an image. Use the docker image build command to create a new image using the instructions contained in the Dockerfile. This example creates a new Docker image called name:tag. Be sure to perform this command from within the directory containing the app code and Dockerfile.

Build Image

docker build -t <image_name>:<tag> <source_of_Dockerfile>

$ docker build -t node-app:latest .

Docker images list

$ docker image ls

Run Container

docker run -d --name <container_name> -p <host_port>:<container_port> <image_name>:<tag>

$ docker container run -d --name=web1 -p=9000:8080 node-app:latest

For Test

$ curl http://localhost:9000

Open a web browser and navigate to the DNS name or IP address of the host that you are running the container from and point it to port 9000. You will see the following web page.

http://localhost:9000