How to Build Apache Webserver Image from running container of base centos docker image. Part-3

preview_player
Показать описание
*|||HIRE ME|||*
Wanna hire me? We build robust secured Hight speed Linux Website Hosting Servers. Weather it is in Azure Cloud, AWS Cloud or any other VPS in Hosting Provider.

*||| VIDEO NOTES |||*
Our Next target is to build apache web server centos image from running container by committing it.
• Let’s list our computer’s docker images using command: docker image ls
• Let’s pull centos base os image from docker hub using command : docker pull centos:latest
• Screen shows Image is up to date for centos:latest it means our previous download is good to use.
• Clear screen
• Let us run new docker container with name centos-custom-apache from base centos image use command : docker run -it –name centos-custom-apache centos:latest
• Edit repository of base image use SED command
This will update repository URLs without opening it in any editor.
• Let’s upgrade the base centos running container use command: yum upgrade -y
• Screen shows docker container is updating.
• Let us install apache web server in running container with following commands
o yum install httpd httpd-tools -y
o copy paste html code from vscode to vi editor and modify a paragraph CENTOS CUSTOM DOCKER IMAGE
o move to location /var/www/html/ use command cd /var/www/html/
• List docker running container use command: docker ps
• List all docker container use command : docker ps -a
• Our custom docker container is running with name centos-custom-apache but in exit state
• Letus commit this container to make docker image from this container use command: docker commit centos-custom-apache centos-custom-apache-image:v1
• Docker image is created
• Let’s list all images using command: docker image ls
• Here we can find our custom made docker image with name : centos-custom-apache-image
• Let’s us list docker running container use command: docker ps
• Here two container is running from image centos-apache:v1 and centos-stream-regularupdate-apache:v1
• Let’s run third container from our newly made custom image use command: docker run -d -p 4000:80 centos-custom-apache-image:v1 /usr/sbin/httpd -D FOREGROUND

the Apache executable normally spawns a couple of child processes and then exits. This behaviour comes in handy during a normal system startup when the init scripting needs to regain control after starting Apache. But in this case it causes the container to stop running as soon as /usr/sbin/httpd exits, which is to say immediately.

Fortunately, there is a way to tell the Apache executable to not exit after spawning its child processes, which is by using the -D FOREGROUND flag to, the Docker statement

• Again list running containers use command: docker ps . Here we found all three containers are running
• Let’s navigate to browse running container in browser, Webserver is accessible at localhost forwarded by port 4000. Our new webserver is running but again we have made this we docker image which will not upgrade itself when operating system releases new updates. In the next section we will make an image following exactly same method but that image accepts OS release updates.

*||| RECOMENDATION |||*
Thank you so much for checking out the content on Learn Computer Technologies. This is a passion project for me, but producing the content isn’t cheap. Anything you can do to help support the channel will reimburse my costs, and motivate me implement new things.
You can support the channel by considering donations.

Cut Your Cloud Bills in Half, Deploy more with Linux virtual machines, global infrastructure, and simple pricing. No surprise bills, no lock-in, and the same price across every data center.

*||| HASHTAGS |||*
#opensource #linux #programming #coding #software #technology #python #javascript #html #programmer #css #github #linuxfan #developer #code #hacking #iot #tech #kalilinux #codinglife #cybersecurity #devops #engineering #geek #linuxmint #webdevelopment #webdeveloper #machinelearning #computer #infosec #development #learntocode #raspberrypi #opensourcesoftware #java #sysadmin #diy #linuxuser #pentesting #softwaredeveloper #bootstrap #ethicalhacking #computerscience #cloud #coders #hacker #ubuntu #archlinux #developers #malware #hackers #themeforest #dprinting #php #cloudcomputing #webdesign

*||| Finger Prints |||*
Рекомендации по теме