How To Run Nginx in a Docker Container On Ubuntu 20.04
Docker container is a virtualized run-time environment where users can isolate applications from the underlying system. These containers are compact, portable units in which you can start up an application quickly and easily.
Offcial Website -https://www.docker.com/
Nginx is a web server which can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Testing Environment: Ubuntu 20.04 LTS
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
apt update ; apt install -y build-essential net-tools curl git software-properties-common neofetch
docker --version ; docker-compose version
docker pull nginx
mkdir -p ~/docker-nginx/html ; cd ~/docker-nginx/html
nano index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page
</div>
</body>
</html>
docker run --name docker-nginx -p 80:80 -d -v ~/docker-nginx/html:/usr/share/nginx/html nginx
docker ps
docker ps -a
http://192.168.1.10/
docker stop docker-nginx
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment