Skip to content

ajinkya48765/Docker-Project---Operations-Repo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

IIEC RISE 1.0 Docker Training

In the month of March 2020 I had training on docker technology where I learnt lots of things under the guidance of Mr. Vimal Daga sir , now we are concluding this training so I have made this project for implementing whatever we have learnt in the 24 hours online class.

This is a project along with my experience while learning docker whatever problems I faced how I resolved them is provided here.

1. System Requirenments :

We will require an operating system it may be bare metal or virtual machine I have used RHEL version 8 for the same. Basically I have windows installed on my machine on the top of it I have installed RHEL 8 as a virtual machine.

2. Docker Installation :

  • First of all copy the path of url from where we are going to install docker https://download.docker.com/linux/centos/7/x86_64/stable/ I would suggest go through this URL for installation. In the RHEL I have configure yum for installing community eddition of Docker.
  • I faced one problem where my docker container was unable to run as security system was refusing so I have got the solution while qna setenforce 0 this will turn of security enforcement.

3. Downloading Images :

  • This is very simple task we just have to pull images of os from https://hub.docker.com/ I have used centos image for configuring my webserver as well as a client .
  • https://hub.docker.com/_/centos this is the official image provided by centos we can pull this image by docker pull centos this command

4. Network creation :

  • I have created my own network for this project for convinience in development.
  • docker network create --driver bridge webnet here driver is network mode I have used bridge as I have to communicate with internet.

5. Server creation :

  • I have launched one centos image in my container using docker run -it centos:latest command.
  • for configuration of webserver I have installed some softwares. First of all I was going to deploy my website on apache webserver so I have downloaded required softwares.
  • for installing apache webserver there are 3 steps
    • Software installation using yum install httpd
    • Deploying webpages inside /var/www/html folder
    • Start services using systemctl start httpd.services but in docker container systemctl process doesn't initializes so we have using yum install httpd I have installed software for webserver.

6. Website Deployment :

  • Now I have to deploy my website on apache webserver as I have mentioned earlier we have keep all the data that we have in /var/www/html folder
  • I have keep my webpages and other data in my github repository https://github.com/ajinkya48765/Docker-Project---Develpement-Repo
  • For github intrigation I have installed git in my image using yum install git.
  • I have fetched all the data from my repo and kept inside that folder.
  • Now we are all set with website deployment now we just have to start service.

7. Configuration for automatically starting server on booting the image :

  • In centos at the time of os booting one file always runs and that is /etc/bashrc so we will keep our command for server creation in it so that everytime when os boots this command will run.
  • while doing this I faced a problem because when os boots it creates process of server creation but and information is stored in /var/run/httpd/ folder so we also have to remove this complete folder before running booting container. I have used rm -rf /var/run/httpd/* command for this.
  • Now my webserver is completely automatic now I just want a volume which will store all of my data.

8. Volume Creation :

  • Volumes are the preferred mechanism for persisting data generated by and used by Docker containers
    • Volumes are easier to back up or migrate than bind mounts.
    • You can manage volumes using Docker CLI commands or the Docker API.
    • Volumes are the preferred mechanism for persisting data generated by and used by Docker containers.
    • Volumes work on both Linux and Windows containers.
    • Volumes can be more safely shared among multiple containers.
    • Volume drivers let you store volumes on remote hosts or cloud providers, to encrypt the contents of volumes, or to add other functionality.
    • New volumes can have their content pre-populated by a container.
  • So I have created a volume called webset for storing all my data using docker volume create webset

9. Image Creation using commit :

  • Now as I have configure normal centos according to my requirenment and I have to save it so we have an option called commit. docker container commit [OPTIONS] container [REPOSITORY : VERSION]

10. Start container using precreated image :

  • now as we have created our own image now we can multiply this as many times we want and can make as many servers we want in just few seconds.
  • But this time while creating an image I have mount my volume in the storage folder I used docker this command.
  • as you can see along with volume I have also used network as my personel network which I have created earlier.

11. Docker Compose :

  • Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services.
    • Start, stop, and rebuild services
    • View the status of running services
    • Stream the log output of running services
    • Run a one-off command on a service
  • We have to create file docker-compose.yml this name should always be same.
  • Then we have some more options like in one click we can build whole infrastructure using docker-compose up command.
  • To stop services temporary we have docker-compose stop
  • To start stopped services we have docker-compose start
  • To destroy whole infrastructure we have docker-compose down

This was all about my learning in 3 weekends. I would like to thank Mr. Vimal Daga Sir for this great opportunity of learning.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors