Skip to content

Running a web server Nginx inside a Docker container and hosting a basic website.

License

Notifications You must be signed in to change notification settings

imsalmanmalik/Deploy-Static-HTML-Website-as-Nginx-Container

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Deploy-Static-HTML-Website-using-Nginx-Container

Running a web server Nginx inside a Docker container and hosting a basic website.

Wrapping in a base image in the dockerfile

FROM nginx:alpine

Copying files from current directory to Nginx web server public directory

COPY . /usr/share/nginx/html

Building a Docker image

Docker build -t webserver-image:v1 .

Running a Docker container

docker run -d -p 80:80 webserver-image:v1

Checking for working container images

docker ps

Checking memory usage

docker stats

HTML starter template

`<!doctype html>

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">

<title>Hello, world!</title>

Hello, world! This is my Docker Container

<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
`

About

Running a web server Nginx inside a Docker container and hosting a basic website.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published