Skip to content

Files

Latest commit

 

History

History
 
 

001-static

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 static-web: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=8080:80 static-web:latest

For Test

$ curl http://localhost:8080

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 8080. You will see the following web page.

http://localhost:8080