What is the use of the command in ubuntu server?
sudo apt update

Update the local package index on an Ubuntu server.
It refreshes the list of available packages and their versions, ensuring you can access the latest software updates and security patches.

what is the use of the following command in ubuntu server?
sudo apt install docker.io -y

Install the Docker package (docker.io) on an Ubuntu server.
The -y flag automatically confirms the installation, bypassing the prompt for user confirmation.

how to check the status of the docker in ubuntu server ?

sudo systemctl status docker

how to run the nginx container with host port number mapping in ubuntu server ?

1. docker run -d --name webservercontainer -p 80:80 nginx -> host port 80; enable HTTP (TCP 80) in the security group.
2. If port 80 is already taken, use docker run -d --name webserverapp -p 8080:80 nginx -> host port 8080; add a Custom TCP (port 8080) inbound rule.
3. Access URLs: http://<dns>:80 for port 80, http://<dns>:8080 for the alternate port.

how to access the docker container from public internet using the port 81 ?

1. Ensure that your EC2 instance's security group allows inbound traffic on port 81.
2. Run the container using the command docker run -d --name (name) -p 81:80 (image-name). -(example: docker run -d --name webapp -p 81:80 nginx)
3. Open your browser and type http://<awsec2publicdns>:81 or http://<public-ip>:81 to access the container.