-
STEP 1 — Create Project Folder
mkdir html-docker
cd html-docker
-
STEP 2 — Create HTML Page
Create file:
Command:
nano index.html
Paste this:
<!DOCTYPE html>
<html>
<head>
<title>My First HTML in Docker</title>
</head>
<body>
<h1>Hello Docker - Static HTML Page!</h1>
</body>
</html>
Save → Exit
-
STEP 3 — Create Dockerfile
Create file:
Command:
nano Dockerfile
Paste:
FROM nginx:alpine
COPY index.html /usr/share/nginx/html/index.html
-
STEP 4 — Build the Image
docker build -t htmlapp .
-
STEP 5 — Run the Docker Container
docker run -d -p 8085:80 --name htmlfile-containers htmlapp
-
STEP 6 — Open in Browser
Visit:
http://localhost:8085
You will see:
Hello Docker - Static HTML Page!