Docker:
Docker is the most revolutionized technology in virtualization world nowadays. Docker is actually an open source project which provides container technology. A container is a lightweight VM(virtual machine) or a process which allows us to install Linux based applications inside it. The container doesn’t have its own Kernel, RAM, CPU and Disk but it uses the underlying OS kernel, RAM, CPU cores and Disk.
Docker is the most revolutionized technology in virtualization world nowadays. Docker is actually an open source project which provides container technology. A container is a lightweight VM(virtual machine) or a process which allows us to install Linux based applications inside it. The container doesn’t have its own Kernel, RAM, CPU and Disk but it uses the underlying OS kernel, RAM, CPU cores and Disk.
Prerequisites:
- An Ubuntu box with installed Docker.
- One User with sudo access.
Step 1- Install Docker in Ubuntu 16.04:
Please follow Step by Step installation of Docker my previous blog- https://linuxhowtoguide.blogspot.com/2018/08/how-to-install-docker-in-ubuntu-1604-lts.html
Step 2- download Dockerfile:
In order to download Dockerfile and other required files, please run following command on you ubuntu terminal.
CD to the cloned directory
Check download files
All the required file has been downloaded successfully.
Step 3- Build own Docker Image:
To build a Docker image with our custom software packages. Please run following command.
Here is the output of our Dockerfile.
# Source Image from ubuntu:16.04 # Mainter Name | |
maintainer Amar Singh | |
# Command to update and install Apache packages | |
RUN apt-get update && apt-get install apache2 -y | |
#to pass all the interactive pop up auto | |
ARG DEBIAN_FRONTEND=noninteractive | |
#Commands to install php7.2 including other modules | |
RUN apt-get install php7.2 php7.2-cli php7.2-common -y | |
RUN apt-get install php7.2-curl php7.2-gd php7.2-json php7.2-mbstring php7.2-intl php7.2-mysql php7.2-xml php7.2-zip -y | |
# Update our TimeZone in php.ini file | |
RUN echo "date.timezone = Asia/Kolkata" > /etc/php/7.2/apache2/php.ini | |
#Create website document root directoy and logs folder | |
RUN mkdir /var/www/html/web1/ | |
RUN mkdir /var/www/html/web1/public/ | |
RUN mkdir /var/www/html/web1/logs/ | |
# Copy index.html and info.php file to Web document folder | |
copy index.html /var/www/html/web1/public | |
copy info.php /var/www/html/web1/public | |
copy info.php /var/www/html | |
#Copy apache virual hostconfiguration file and enable it | |
copy testamar.conf /etc/apache2/sites-available/ | |
RUN a2ensite testamar.conf | |
#Check apache server configuration | |
RUN apachectl -t | |
# open port | |
EXPOSE 80 | |
# Command to run Apache server in background | |
CMD /usr/sbin/apache2ctl -D FOREGROUND |
Build Docker Image:
Wait until the process gets finished. your output must be like this in the end.
Our Docker image with Apache2.4 and PHP7.2 has been built successfully. Let's check our image using the command below.
An image has been successfully built, let's test our image by building a container and check php version.
Step 4- Test our docker image:
Once our image is built, we can run a container from our custom image, run following command to create a container.
Verify created container:
Step 5- Verify container and PHP version
In order to Verify container and PHP version open browser and access host IP address with port 8080
Successfully built Docker image and ran a Container with our custom image.
Step 6- Push our image to Docker hub:
once our image is built, we can push it to our docker hub account so we can use it everywhere we need it.
let's follow the steps below to push docker image.
- Tag our custom image with our Docker hub account username.
- push image to docker hub account.
Docker image has been successfully pushed to Docker hub account. Now, you can use this Image in your .yml file to create a stack.
Great Article !! Thanks for sharing..
ReplyDeleteDocker Online Training
Kubernetes Online Training
Kubernetes Training in Hyderabad
Best Docker and kubernetes training in ameerpet
Docker and Kubernetes Training in Hyderabad
Nice Posting !! Thanks for sharing..
ReplyDeleteDocker Training in Hyderabad
Docker and Kubernetes Online Training
Docker Training
Docker Online Training
Kubernetes Online Training
Kubernetes Training in Hyderabad
Best Docker and kubernetes training in ameerpet
Docker and Kubernetes Training in Hyderabad
Nice Posting !! Thanks for sharing..
Docker Training in Hyderabad
Docker and Kubernetes Online Training
Docker Training
Docker Online Training
Kubernetes Online Training
Kubernetes Training in Hyderabad
Best Docker and kubernetes training in ameerpet
Docker and Kubernetes Training in Hyderabad
Thanks for sharing nice information.
ReplyDeleteand also we are providing E-Learning Portal Videos for students and working Professionals
Hurry Up! Bag All Courses in Rs - 10000 /- + taxes
41 Career building courses.
Designed by 33 industrial experts
600+ hours of video Content
DevOps and Cloud E-Learning Portal
Thanks for sharing...
ReplyDeleteDocker Online Training
Kubernetes Online Training
Kubernetes Training in Hyderabad
Thanks!! for sharing......
ReplyDeleteDocker Online Training
Kubernetes Online Training
Kubernetes Training in Hyderabad
Docker and Kubernetes Training in Hyderabad
Great blog!! Thanks for sharing
ReplyDeleteKubernetes Online Training
Docker Online Training
Kubernetes Training in Hyderabad
Thanks for sharing such a wonderful blog !
ReplyDeleteDocker and Kubernetes Training in Hyderabad
Kubernetes Online Training
Docker Online Training
Thank you! Very nice post. Your suggestions and ideas really good.
ReplyDeletebest cameras for beginner
best cameras for photography
Best cameras for streaming