GithubHelp home page GithubHelp logo

dockerizing_custom_webserver's Introduction

Dockerizing_custom_webserver

Objective:

The objective of this assignment is to familiarize yourself with Docker and containerization by Dockerizing a simple HTML page using Nginx as the web server.

Requirements:

Install docker in ubuntu machine

sudo apt install docker.io -y

image

  1. Basic HTML Page:

    • Create a plain HTML page named index.html with some content (e.g., "Hello, Docker!").
#------------------index.html---------------------------------
<!DOCTYPE html>
<html>
<head>
    <title>Hello, Docker!</title>
</head>
<body>
    <h1>Hello, Docker!</h1>
    <p>This is a plain HTML page served by Nginx in a Docker container.</p>
</body>
</html>
#-------------------------------------------------------------------
  1. Nginx Configuration:

    • Create an Nginx configuration file named nginx.conf that serves the index.html page.

    • Configure Nginx to listen on port 80.

#-----------------------------nginx.conf-------------------------
events {}
http {
    server {
        listen 80;
        location / {
            root /usr/share/nginx/html;
            index index.html;
        }
    }
}
#----------------------------------------------------------------
  1. Dockerfile:

    • Create a Dockerfile to define the Docker image.

    • Use an official Nginx base image.

    • Copy the index.html and nginx.conf files into the appropriate location in the container.

    • Ensure that the Nginx server is started when the container is run.

#---------------------------Dockerfile----------------------
FROM nginx:latest
COPY index.html /usr/share/nginx/html/index.html
COPY nginx.conf /etc/nginx/nginx.conf
#-----------------------------------------------------------
  1. Building the Docker Image:

    • Build the Docker image using the Dockerfile.
docker build -t custom_webserver:v1 -f dockerfile .

image

Lets! Test the image

docker run -it -d  -p 8080:80 custom_webserver:v1

image

Its working fine WOW!

  1. Push the image on ECR

    • Make the public repository and push them on the ECR
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

apt install unzip
unzip awscliv2.zip
sudo ./aws/install
aws --version
aws configure

AWS Access Key ID:
AWS secret Acess Key:
Default region name: ap-south-1
Default output format:

image

image

image

https://gallery.ecr.aws/c3w1m1q2/docker_customwebservice_adarsh

dockerizing_custom_webserver's People

Contributors

adarshiitdh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.