E-mail : support@tech2now.in

How to install nginx in docker using docker file

Docker Containers

Steps create docker file

vim dockerfile

#Use a base image
FROM nginx:latest

#Set the working directory
WORKDIR /usr/share/nginx/html

#Copy the application files to the working directory
COPY index.html .

#Expose port 80
EXPOSE 80

#Start the Nginx server
CMD [“nginx”, “-g”, “daemon off;”]

Save the dockerfile wq:

Run the command build docker images.

$docker build -t my-web-app .