Task 7.2. (A and B): Docker Task:

Jyoti Pawar
4 min readJan 3, 2021

šŸŒ€ 7.2: Docker Task
šŸ”…Configuring HTTPD Server on Docker Container
šŸ”…Setting up Python Interpreter and running
Python Code on Docker Container

1.Configuring HTTPD Server on Docker Container

For this we need to follow some steps

Sub-task 1:

  • Configure yum repository in order to install docker
  • Install docker-ce in the host-OS
  • Start the docker services

Sub-Task 2:

  • Pull a centos image from the docker repository
  • Launch a centos container
  • Install httpd software in the container
  • Start the services
  • Test the services are working or not
  • Put the web content on the web server
  • Test the services

Sub-Task 3:

  • Install python3 in the container
  • Launch the python interpreter to run python functions and commands

Sub-task 1:

In order to install the docker we are going to use the yum (you can also use dnf) to install docker

Yum or dnf is command in linux we can use to install any software it also installs any dependencies regarding the software for the user

But to install using yum or dnf we need to tell them from where they need to install the software. Typically we need to set the repository. They can actually download and install software from file, folder and url as well.

Now we need to install docker-ce by using below cmd

Now we need to start the docker services in the base os. Using the command

#systemctl start docker

Sub-task 2:

  • Now install the image on dockee to run the container.

#docker pull centos

By default it pull the latest centos image from the docker hub

  • Now run the container on top of docker

#docker run -itā€Šā€”ā€Šname MyWebOS centos:latest

  • First install the httpd service on the CentOS container

#yum install httpd

  • Install the net-tools package. Because in CentOS ifconfig cmd is not working so to use this cmd and to get our CentOS containerā€™s IP we need to install net-tools.

Now we can use the ifconfig cmd:

  • Now put the web content inside docker.html file inside /var/www/html folder
  • docker.html file contains:
  • Next we need to start httpd web server Now the challenge is systemctl command doesnā€™t work in docker container. But we know behind the seen systemctl run a file /usr/lib/systemd/system/httpd.service and in that the service is started using /usr/sbin/httpd/

So use below cmd to start the httpd service

Now in the browser we can see our service is running perfectly.

Sub-task 3:

  • Install the python3 software inside container
  • Now run the python interpreter

So, TASK COMPLETED.

Thank you friends for reading my articleāœļøšŸ˜ŒšŸ˜Œ

Sign up to discover human stories that deepen your understanding of the world.

Jyoti Pawar
Jyoti Pawar

Written by Jyoti Pawar

Devops || AWS || ML || Deep learning || Python || Flask || Ansible RH294 || OpenShift DO180

No responses yet

Write a response