How to Dockerise a simple Web Application / Host on a Nginx Server
Nginx, stylized as NGINX or nginx or NginX, is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. This can be used to host web Applications.
In this lab exercise, you will learn how to create a simple web App, Create an Nginx container and deploy that App into the container. And view the results on your browser
Prerequisites:
Install Docker
Step 1: Create the web App(HTML)
Log into your docker machine
Create the Html file using Vi Editor
$ vi index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Smashing Champions Web App!</title>
</head>
<body >
We are champions
we are champions!
</body>
</html>
#FROM is the base image for which we will run our application
FROM nginx:latest
# Copy files and directories from the application
COPY index.html /usr/share/nginx/html
# Tell Docker we are going to use this port
EXPOSE 80
Place your image id in place of highlighted yellow
No comments:
Post a Comment