{"id":22650696,"url":"https://github.com/kausalyanp/docker-nginx-application","last_synced_at":"2026-04-14T14:32:25.028Z","repository":{"id":262827012,"uuid":"888472028","full_name":"kausalyanp/docker-nginx-application","owner":"kausalyanp","description":"Building a custom docker image using Ubuntu as a base docker image and running the nginx application. This docker image is built using a Dockerfile.","archived":false,"fork":false,"pushed_at":"2024-11-15T12:14:14.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T07:23:58.622Z","etag":null,"topics":["application","bash","docker","docker-image","dockerfile","ec2-instance","linux","nginx","nginx-docker","ubuntu"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kausalyanp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-14T13:09:23.000Z","updated_at":"2024-11-17T15:18:32.000Z","dependencies_parsed_at":"2025-02-03T20:48:50.348Z","dependency_job_id":"a62c27d4-44dc-4cfb-ba00-c7f936b2bf79","html_url":"https://github.com/kausalyanp/docker-nginx-application","commit_stats":null,"previous_names":["kausalyanp/docker-nginx-application"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kausalyanp/docker-nginx-application","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kausalyanp%2Fdocker-nginx-application","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kausalyanp%2Fdocker-nginx-application/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kausalyanp%2Fdocker-nginx-application/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kausalyanp%2Fdocker-nginx-application/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kausalyanp","download_url":"https://codeload.github.com/kausalyanp/docker-nginx-application/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kausalyanp%2Fdocker-nginx-application/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31801317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T11:13:53.975Z","status":"ssl_error","status_checked_at":"2026-04-14T11:13:53.299Z","response_time":153,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["application","bash","docker","docker-image","dockerfile","ec2-instance","linux","nginx","nginx-docker","ubuntu"],"created_at":"2024-12-09T08:36:48.552Z","updated_at":"2026-04-14T14:32:25.008Z","avatar_url":"https://github.com/kausalyanp.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-nginx-application\nBuilding a custom docker image using Ubuntu as a base docker image and running the nginx application. This docker image is built using a Dockerfile.\n\nStep 1: Install Docker\n\n```\n#!/bin/bash\n# Add Docker's official GPG key:\nsudo apt-get update\nsudo apt-get install ca-certificates curl\nsudo install -m 0755 -d /etc/apt/keyrings\nsudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc\nsudo chmod a+r /etc/apt/keyrings/docker.asc\n\n# Add the repository to Apt sources:\necho \\\n  \"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \\\n  $(. /etc/os-release \u0026\u0026 echo \"$VERSION_CODENAME\") stable\" | \\\n  sudo tee /etc/apt/sources.list.d/docker.list \u003e /dev/null\nsudo apt-get update\n\n# To install the latest version, run:\nsudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin\n\n# Verify that the Docker Engine installation is successful by running the hello-world image.\nsudo docker run hello-world\n```\nStart and Enable Docker:\n\nStart the Docker service and enable it to run on system startup.\n```\nsudo systemctl start docker\nsudo systemctl enable docker\n```\n\nVerify Docker Installation:\n\nRun the following command to check if Docker was installed correctly.\n```\ndocker --version\n```\n\nStep 2: Set Up Project Directory and Dockerfile\nCreate a Project Directory:\n```\nmkdir nginx-docker\ncd nginx-docker\n```\nCreate a Dockerfile:\n```\ntouch Dockerfile\n```\nStep 3: Write the Dockerfile\nOpen the Dockerfile and add the following content:\n```\n# Use Ubuntu as the base image\nFROM ubuntu:latest\n\n# Update package list and install NGINX\nRUN apt-get update \u0026\u0026 \\\n    apt-get install -y nginx \u0026\u0026 \\\n    rm -rf /var/lib/apt/lists/*\n\n# Expose port 80 for HTTP traffic\nEXPOSE 80\n\n# Start NGINX when the container starts\nCMD [\"nginx\", \"-g\", \"daemon off;\"]\n```\nStep 4: Build the Docker Image\nRun the following command to build the Docker image from the Dockerfile:\nThe -t flag tags the image as custom-nginx for easy reference.\n```\ndocker build -t custom-nginx .\n```\n\nStep 5: Run the Docker Container with Host Network Mode\nRun the container with the host network to make it accessible on the host’s public IP:\n1. -d refers to run in detached mode. \n2. The --network host option tells Docker to use the host network mode for the container.\n```\ndocker run -d --name my-nginx-container --network host custom-nginx\n```\nStep 6: Test Access on Public IP\nGet the Host's Public IP\nAccess NGINX:\nOpen a browser(incognito mode preferred) and go to your public IP (http://\u003cyour-public-ip\u003e) to view the default NGINX welcome page.\n\n![Screenshot 2024-11-14 183553](https://github.com/user-attachments/assets/875fdbe2-e596-40be-9a85-b86c1ca17f70)\n\nNotes:\n1. Run the following command to check if your NGINX container is up and running.\n   ```\n   docker ps\n   ```\n2. If the container is not running, try to start it:\n   ```\n   docker start \u003cmy-nginx-container\u003e\n   ```\n3. Check the logs of the NGINX container for any errors that might have occurred.\n   ```\n   docker logs \u003cmy-nginx-container\u003e\n   ```\n4. To see if the image is created\n   ```\n   docker images\n   ```\n   \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkausalyanp%2Fdocker-nginx-application","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkausalyanp%2Fdocker-nginx-application","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkausalyanp%2Fdocker-nginx-application/lists"}