HTTPD Server Configuration on Docker Container

HTTPD Server Configuration on Docker Container

DOCKER is computer software used for Virtualization in order to have multiple Operating systems running on the same host. Unlike Hypervisors which are used for creating VM (Virtual machines), virtualization in Docker is performed on system-level in so-called Docker containers.

Docker images are the "source code" for our containers; we use them to build containers. They can have software pre-installed which speeds up deployment. They are portable, and we can use existing images or build our own.

Docker containers run in an isolated environment on top of the host's OS. Even if your host runs Windows OS, you can have Linux images running in containers with the help of Hyper-V, which automatically creates a small VM to virtualize the system's base image, in this case, Linux.

Containers are the organizational units of Docker. When we build an image and start running it; we are running in a container. The container analogy is used because of the portability of the software we have running in our container.

In simple terms, an image is a template, and a container is a copy of that template. You can have multiple containers (copies) of the same image.

Step - 1 Install Docker -

URL form where you can download Docker Package

https://download.docker.com/linux/centos/7/x86_64/stable/

Check with this command that YUM is configured on Not -

  # yum repolist

(B) Install Docker With YUM -

Most compatible version of Docker is 18 & URL for docker We use in YUM configuration will not resolve latest version dependencies , so use "--nobest" option

  # yum install docker-ce -y --nobest

Step - 2 Launch Docker Container -

(A) Start Docker Services -

  # systemctl start docker

(B) Pull Docker Image

# docker pull centos
No alt text provided for this image

(c) Run Centos Container

# docker run -it --name httpd centos
No alt text provided for this image

(d) Install Apache Httpd Web Server Inside Docker Container -

  # yum install httpd -y

we have to run apache in foreground: /usr/sbin/apache2 -DFOREGROUND

The .bashrc file is a shell script which is run every time a user opens a new shell.The .bashrc file is a good place therefore to run commands that you want to run every single time you open a shell.To run apache in foreground every single time when we open shell we write the command in .bashrc file

No alt text provided for this image

(e) Commit Changes to Image:

# docker commit httpd myhttpdos



Finally, create a new image by committing the changes


No alt text provided for this image

(f) export the port on port 8090

# docker run -dit -p 8090:80 --name httpdserver myhttpdos
No alt text provided for this image
No alt text provided for this image

------------------------------------------------thank you---------------------------------------------------






要查看或添加评论,请登录

Himanshu Agrawal的更多文章

  • Microsoft automates to achieve more with Ansible

    Microsoft automates to achieve more with Ansible

    What is Ansible Ansible is an open-source software provisioning, configuration management, and application-deployment…

  • Kubernetes and It's Use Cases

    Kubernetes and It's Use Cases

    What we are going to learn in this Block:- Why KUBERNETES? What is KUBERNETES What Kubernetes is NOT Uses of KUBERNETES…

  • NEURAL NETWORK AND IT'S INDUSTRIAL USE CASE

    NEURAL NETWORK AND IT'S INDUSTRIAL USE CASE

    What we are going to learn in this block: Introduction to NEURAL NETWORK (NN). Why Neural Network What is Neural…

  • How Tech Giant Using Big Data

    How Tech Giant Using Big Data

    In 2020, data is everywhere. Compared to the late 80's you'll find that we've gathered tremendous data.

  • Deploying WordPress WorkLoad and Prometheus On Amazon EKS

    Deploying WordPress WorkLoad and Prometheus On Amazon EKS

    What is Amazon EKS? Amazon EKS (Elastic Container Service for Kubernetes) is a managed Kubernetes service that allows…

    10 条评论

社区洞察

其他会员也浏览了