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.
Install the Docker package (docker.io) on an Ubuntu server.
The -y flag automatically confirms the installation, bypassing the prompt for user confirmation.
sudo systemctl status docker
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.
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.