How to Deploy Nginx in a Docker? Also, How to Deploy Frontend with Nginx & Docker? Part-2

Опубликовано: 29 Апрель 2026
на канале: Tech With Azizul
22
3

Project-1: Deploy Nginx in Docker Container
Project-2: Deploy Frontend (Three-tier app) with Nginx and Docker

Project High Level :
Create EC2 then connect with Mobaxterm
Install Docker
Create a Docker image.
Run Nginx in/outside the container from the terminal and from the browser.
Link Docker with Nginx
Deploy Frontend of a three-tier application

Docker commands:

sudo apt update && sudo apt install docker.io -y
sudo systemctl status docker
(Search for the node images from the search bar and select Docker Official Image of node. Go to the Tags tab and copy the installation command of the latest node version)
sudo docker pull node:latest

(Search and select the Nginx image in a similar way from Docker Hub. Copy the nginx image installation command)

sudo docker pull nginx
sudo docker images

To avoid writing sudo in order to run Docker commands every time, the ubuntu user can be added to the docker user group. Run the command

sudo usermod –aG docker ubuntu
To see list of user group
cat /etc/group (at bottom, ubuntu is added to docker user group
Exit
R
Now you can write Docker commands without being a superuser.
docker run nginx:1.24
docker ps –a ( to see all the running docker processes)
docker ps (to see currently running docker )

Open the nginx container interactive shell with bash. Run the command
docker exec –it container id / name bash

Run Nginx inside container with the command
curl localhost:80
Exit
Docker ps
Docker inspect container id / name

Scroll to the NetworkSettings, and copy the IPAddress

Now you can run the nginx from the terminal with the copied IP Address
curl IP address:80

see Nginx !