We want to containerize a simple HTML page. To do that you’ll need to create a Dockerfile.
Add a new file and name it Dockerfile (without any file extension).
Copy and paste the following in the file and save it:
FROM nginx:alpine
COPY index.html /usr/share/nginx/html
docker build -t hello-world:v1 .
docker images
docker run -d -p 8080:80 --name hello hello-world:v1
docker ps
curl localhost:8080
or use your browser. Navigate to https://localhost:8080
Refresh the browser to confirm that it has stopped
docker stop hello
You should not see the hello-world:v1 instance anymore.
docker ps
docker rm hello
docker ps
docker images
docker rmi hello-world:v1