Use Cases of docker
Deploy Web Servers and Python Environment Setup
Nowadays, Industry fully depends on container engine. Today, I talk about one of them engine which is docker. Now, Industry uses docker in very different way like they use container orchestration engine where they manage the container engines(docker) behind the scene. But today, I am not go there. I just show you how docker uses but the management part I will show you in my future articles.
There is a lots of use-cases but I show you the two main.
- Web-Server
- Language environment
Web Server configure using docker
We use Centos image of docker where we configure web server. We can also use httpd image directly and configure the web-server. I just give you different flavour of installing web-server. I am not show here, the docker installation part.
- Pull the centos image from docker repository.
docker pull centos
2. We run this image and go inside it.
docker run -it centos
After that, you will see you are in a new system. Best part of centos image is they give pre-configured yum repository. You can check by using command yum repolist
Now you install the apache httpd software
yum install httpd
3. Configure the httpd software. Create a html file in /var/www/html. Write content what you want to show in your web-app. Here, give you example what I write in my file.
4. Start the service of httpd software.
/usr/sbin/httpd
Your web-app is ready but docker is a little bit secure they can’t access to public guys connect. But we have a solution. docker give a option -p
so if anyone connect there base OS with a given port so they transfer the request in the docker image. So at the time of Image launch use command:
docker run -it -p 80:80 centos
Now, if you connect to the base OS with a given port you see the web-app
Language environment setup using docker
I setup the python environment inside docker. For python also docker image available. But this also I show you from the Centos image. After run the centos image
- Install python software
yum install python3
2. Run the python environment.
python3
As onwards, there is a lots of use-cases of docker. If you find any image use docker repository which is docker hub. You find almost all docker images or you can create your own image also. I will try to show you how you can create your own docker image and upload on docker hub in future.
Thank you for reading!