🔅(A) — Configuring HTTPD Server on Docker Container
🔅(B) — Setting up Python Interpreter and running Python Code on Docker Container
What is docker?
In simple words, docker is a containerizing application that means we can do same things that can be done by an operating system with the help of docker but the main advantage of docker is we can launch any operating system within the seconds, and also it has the concept of virtualization means we can have shared resources between multiple operating systems.
what are the advantages of docker over virtual machines?
- Docker containers are process-isolated and don’t require a hardware hypervisor. This means Docker containers are much smaller and require far fewer resources than a VM.
- Docker is fast. Very fast. While a VM can take at least a few minutes to boot and be dev-ready, it takes anywhere from a few milliseconds to (at most) a few seconds to start a Docker container from a container image.
- Containers can be shared across multiple team members, bringing much-needed portability across the development pipeline. This reduces ‘works on my machine’ errors that plague DevOps teams.
How to install the docker and launch container
Here is the docker go and download using the rpm command
Now to launch any operating system that is known as a container we need an image so we have first download that image using the docker pull command
let’s pull HTTPd server image
now we are going to launch simple web pages on httpd server. To do so we have to first launch the container and then upload our web pages in /var/www/html file of the container so that anyone can see the webpages
Note: you have to disable the firewall for sometime
Let’s do it step by step
- first, pull image using docker pull command.
docker pull centos:latest
2.Now create and run the container using the docker run command
docker run -it — name myos1 centos:latest
now as you have landed inside the container now install httpd,python interpreter,net-tools,pip
also add you code to /var/www/html file and run /usr/sbin/httpd command to start httpd service inside the docker
That’s all for today you can connect me on Linkedin