Giter Club home page Giter Club logo

apache-server-docker-image's Introduction

Apache Server Docker Image

This repository contains a Dockerfile to build an Apache server image and instructions on how to run it using Docker.

Prerequisites

Usage

Step 1: Create an EC2 Instance

  1. Open the AWS Management Console and navigate to the EC2 Dashboard.

  2. Click on "Launch Instance" to create a new EC2 instance.

  3. Follow the steps in the EC2 instance launch wizard, selecting an Amazon Machine Image (AMI), choosing an instance type, configuring instance details, adding storage, configuring security groups, and reviewing.

  4. In the "Configure Security Group" step, make sure to add a rule to allow incoming traffic on port 80 (HTTP).

  5. Launch the instance and download the key pair.

  6. Connect to your EC2 instance using SSH:

    ssh -i your-key-pair.pem ec2-user@your-instance-ip

    Replace your-key-pair.pem with the path to your key pair file and your-instance-ip with your EC2 instance's public IP address.

Step 2: Install Docker on the EC2 Instance

  1. Update the package list:

    sudo yum update -y
  2. Install Docker:

    sudo amazon-linux-extras install docker
    sudo service docker start
    sudo usermod -a -G docker ec2-user

    Note: You may need to re-login or run su - ec2-user to apply the group changes.

Step 3: Pull the Docker Image

docker pull httpd

This command pulls the official Apache HTTP Server Docker image from Docker Hub.

Step 4: Run the Apache Server Container

docker run -d --name apache -p 80:80 httpd
  • -d: Run the container in the background.
  • --name apache: Assign the name "apache" to the container.
  • -p 80:80: Map port 80 on the host to port 80 on the container.
  • httpd: The name of the Docker image.

Step 5: Access the Apache Server

Open your web browser and navigate to your EC2 instance's public IP address:

http://your-instance-ip

For example, if your instance's IP address is 54.123.456.789, access the Apache server by navigating to http://54.123.456.789 in your web browser.

Stop and Remove the Container

docker stop apache
docker rm apache

Replace apache with the name you assigned to your container.

License

This project is licensed under the MIT License.

apache-server-docker-image's People

Contributors

swetamishra123 avatar

Stargazers

 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.