Before starting the configuration I think you should know a little bit about Docker. So let’s start with the introduction of Docker without any delay.
Introduction of Docker :
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.
Installation of Docker :
Hopefully, now you have a clear idea of why docker is used by us. So let’s see the installation of docker.
Note: Here I am installing the Docker on the top of AWS Redhat Instance But you can use any operating system with the same approach.
Login with root power using sudo su command and go inside the /etc/yum.repos.d/ directory using the below-mentioned command.
After saving the d.repo file and run the below-mentioned command to install the docker software.
#yum install docker-ce — nobest -y
So docker software has installed or not you can check with help of the below command.
Now you can see Docker has installed on the top of AWS Redhat Instance. So, start the docker services using the below command.
#systemctl start docker
Now you can see in the above screenshot that Docker has a running state now. But when you will shut down your system and restart again. At that time, you have to restart the docker services again using systemctl start docker so if you want that you have not to do the same thing again & again then run the below command for enabling docker services permanently.
#systemctl enable docker
Now Docker installation has done. So you can use all the docker services as you want.
1.Configure WebServer on the top of Docker Container
2. Setting up Python Interpreter and running Python Code on Docker Container
Configure WebServer on the top of Docker Container
3 Steps to Configure a WebServer
- Install the Server Program
- Configuration of Server
- Start the server
So let’s see step by step how to configure the server on the docker. But before configuring, pull the docker image from DockerHub using the below-mentioned command.
Note: You can pull any image from the docker hub which you want using the same below command.
#docker pull imagename:imageversion
So launch the docker container using the below command.
#docker run -it — name containername imagesname:imageversion
Now the container is ready for the configuration of the Webserver So install the webserver using the below-mentioned command.
#yum install httpd -y
After installing the Webserver go inside the /var/www/html directory and make a webpage as the below mentioned.
Make a webpage according to your comfort.
After making the webpage you have to start the webserver but when you will start it in a regular way then you will face this type of problem.
So resolving this problem run the below command.
Copy your container IP ( 172.17.0.2 ) and try to access the webpage through your local server using the below-mentioned command.
We are able to access the webpage now. So Webserver has configured.
Setting up Python Interpreter and running Python Code on Docker Container
yum install python3 -y
Check the Python has installed or not using python3 -version
Make workspace for the python as mentioned in the below screenshot and write any python code.
Now run the code using python3 filename.py
In this article, we have seen how we can configure the Webserver and set up the Python environment on the top of Docker as well as how we can install the docker software on our local server . So hopefully you have really enjoyed this article.
Suceessfully completed Task 7.2 ……………
Thanks for reading
Keep Learning . Keep Sharing ……………..
Thank You …………………….