Configure HTTPD Server and Python Interpreter on Docker Container
Docker Task

Configure HTTPD Server and Python Interpreter on Docker Container

Task Description ??

?? 7.2: Docker Task

??Configuring HTTPD Server on Docker Container

??Setting up Python Interpreter and running Python Code on Docker Container

Let's to start task first know about Docker and Docker Container.

What is Docker ?

 Docker is an open-source technology used mostly for developing, shipping, and running applications. With it, you can isolate applications from their underlying infrastructure so that software delivery is faster than ever. Docker’s main benefit is to package applications in “containers,” so they’re portable for any system running the Linux operating system (OS) or Windows OS. Though container technology has been around for a while, the hype around Docker’s approach to containers has moved this approach to the mainstream as one of the most popular forms of container technology.

What is Docker Container ?

A Docker container, as partially explained above, is a standard unit of software that stores up code and all its dependencies so the application runs fast and reliably from one computing environment to different ones. A Docker container image is a lightweight, standalone, executable package of software that has everything you need to run an application – code, runtime, system tools, system libraries, and settings.

Let's to start task:

??Configuring HTTPD Server on Docker Container

 Firstly we have to install docker in our system. To install docker we use the command yum install docker-ce . To install docker yum needs a repository to install any software or packages. For that we have first go to /etc/yum.repos.d/, and create a repo file for docker software.

  1. cd /etc/yum.repos.d/
  2. vim docker.repo
cd   /etc/yum.repos.d/
vim docker.repo
docker.repo
No alt text provided for this image

Now we have to install docker using following commands: yum install docker-ce --nobest

install docker

To check the docker version using command: docker --version

docker --version

After installation of docker we have to check Docker service is started or not. To check Docker service is started or not use command: systemctl status docker

systemctl status docker

To start Docker Service using following command: systemctl start docker 

systemctl start docker

To check the docker information using following command: docker info

docker info

Here we can see there is no image available in docker and none of the container is running. To launch a new container or OS in Docker, we need Docker image.

Now pull a Docker Image from Docker Hub using following command: docker pull 'image_name:version'

docker pull centos:latest

To check the available images in docker using following command: docker images

docker images

To run a Docker Container using following command: docker run -it os_name:os_version

and To install httpd webserver using following command: yum install httpd

docker run -it os_name:os_version

To start the httpd service but systemctl command doesn’t support in docker container. So we will use command to start httpd is : /usr/sbin/httpd

/usr/sbin/httpd

Now create a web page inside the container. First run this cd /var/www/html to go Document root directories. Here we create a web page task7.2.html

web page

Install ifconfig command software. In docker container ifconfig command is not available we have to install that using software which name net-tools we use command to install ifconfig command is yum install net-tools

yum install net-tools

Now we check the IP of the Docker Container using ifconfig command.

ifconfig

Now we see web page in the browser using IP address/filename

IP address/filename

??Setting up Python Interpreter and running Python Code on Docker Container

First we have to install the python3 inside the Docker Container. Use following command to install python3 is yum install python3

yum install python3

To check python3 is installed or not using following command: python3 --version

python3 --version

Now we use Python3 REPL interpreter to execute python code.

REPL


Finally Task is Completed. Thank You for Reading ??




Shweta Bhardwaj

Software Engineer at Infosys Limited/Java/Spring-Boot/Back-End Developer

4 年

Good Work ??

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

Shalini Rana的更多文章

  • How industries are solving challenges using Ansible.

    How industries are solving challenges using Ansible.

    ARTH - Task 11 ??????? Task Description?? ?? 11.2 Create a Article, blog or Video on how industries are solving…

  • Elasticity Task

    Elasticity Task

    First to start the task, lets know about the some concepts: What is Hadoop? Apache Hadoop is an open source software…

    2 条评论
  • Create High Availability Architecture with AWS CLI

    Create High Availability Architecture with AWS CLI

    What is a Web-Server? A web server is software and hardware that uses HTTP (Hypertext Transfer Protocol) and other…

    2 条评论
  • AWS Command Line Interface (AWS CLI)

    AWS Command Line Interface (AWS CLI)

    What is the AWS Command Line Interface? AWS Command Line Interface (AWS CLI) is a unified tool using which, you can…

    2 条评论
  • Machine Learning And Its Use Case

    Machine Learning And Its Use Case

    What is Machine Learning? Machine learning is an application of artificial intelligence (AI) that provides systems the…

    4 条评论
  • Cloud Computing

    Cloud Computing

    Cloud computing has two meanings. The most common refers to running workloads remotely over the internet in a…

    8 条评论

社区洞察

其他会员也浏览了