DevOps Batch Nov 2023 Notes

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Docker

What is Docker?
Why Docker?
How Docker works?
How to install docker?
Component of Docker?
	docker soft
	docker image
	docker registry
	docker container

Lifecycle of Container?
Working / Accessing Containers
Troubleshooting Containers?

How to create image?
How to share with?
====================================
Linux?
Linux Kernel
VMS
--------------------------
What is VirtualBox?
	Vms mgmt platform
	create -> start -> stop -> restart -> pause -> unpause -> kill --> rm

What is Docker?
	Container mgmt platform
	Release
		Comm -- FREE
		Enterprise - PAID
	Wriiten in Go
	by Solomna hykes
	Version
		22.X
	

	platform/tool
	- Save cost
		VMS--APP	Container
		========	==========
		  1C1GB		 1/5 of the of vm
	- Save time
		VMS		Container
		5mins		1 sec
	- IMp Quality
		Code quality
		test quality

	mgmt
	create -> start -> stop -> restart -> pause -> unpause -> kill --> rm


	Container
	----------------------------
	How APP runs?
	What are the resources we need to run 1 APPS?

	Func - Lightweight APP running env
	Tech - Container is 
				1 PID NS 	1 USER NS	1 NET nS 	1 MNT NS
						Requestd by Docker
								Created by Kernal

	HARDWARE
			OS
		===================
		BOOTFILE + ROOTFILE
		===================
	        Kernel   + ROOTFILE

			====================
Kernel - The kernel is a computer program at the core of a computer's operating system and generally has complete control over everything in the system.

	Kernel
		Namespace		CAN		ALLOWED			NEED	
			USER		- N		MULTPLE			1
			NET		- N		1			1
			PIDTREE		- N		1			1
			MNT(RFS)	- N		1			1
		Cgroups
			Allocating CPU and RAM to PID
		Capabilities
			ubuntu
			root

===================================================
How to start with Docker?

Step 1 - install docker?
https://www.devopsschool.com/blog/how-to-install-docker-in-linux/

Step 2 - Download docker image - httpd

Step 3 - FROM Registry - https://hub.docker.com/

Step 4 - create -> start -> stop -> restart -> pause -> unpause -> kill --> rm

 11  clear
   12  docker images
   13  docker pull httpd
   14  docker images
   15  clear
   16  docker version
   17  clear
   18  docker info
   19  clear
   20  docker  images
   21  docker ps
   22  docker ps -a
   23  docker create httpd
   24  docker ps -a
   25  docker create --name raj1 httpd
   26  docker ps -a
   27  docker start 57b4b52a7cc2
   28  docker ps -a
   29  docker start 85f139f50fcb
   30  docker ps -a
   31  docker stop 85f139f50fcb
   32  docker ps -a
   33  clear
   34  docker restart 57b4b52a7cc2
   35  docker ps -a
   36  docker pause 57b4b52a7cc2
   37  docker ps -a
   38  docker stats
   39  docker ps -a
   40  docker unpause 57b4b52a7cc2
   41  docker ps -a
   42  docker kill 57b4b52a7cc2
   43  docker ps -a
   44  clear
   45  docker ps -a
   46  docker rm 57b4b52a7cc2
   47  docker ps -a
   48  history


Step 5 - how to access a container.
===============================================
		RUN
-----------------------------------
pull -> create -> start --> attached

		RUN -d 
-----------------------------------
pull -> create -> start --> DO NOT attached(PID1)

Concept
======================================================
PS is running		Vm is running		container is running
---------------------------------------------------------------------
coz of
first pid		firstpid		firstpid
==============================================================
kernal			kernal			any executable - java - python



docker run -d -p 80:80 httpd
docker run -d -p 81:80 httpd
docker run -d -p 82:80 httpd


  49  clear
   50  docker ps -a
   51  docker start 85f139f50fcb
   52  clear
   53  docker ps -a
   54  docker inspect 85f139f50fcb
   55  clear
   56  ls
   57  curl http://172.17.0.2
   58  ifconfig
   59  ip a
   60  clear
   61  docker ps
   62  docker ps -a
   63  docker run httpd
   64  docker ps
   65  docker ps -a
   66  cler
   67  clear
   68  docker run -d httpd
   69  docker ps
   70  clear
   71  ls
   72  docker ps
   73  docker inspect 8119bd677b1e
   74  cler
   75  curl http://172.17.0.8
   76  clear
   77  ls
   78  docker run -d -p 80:80 httpd
   79  docker run -d -p 81:80 httpd
   80  docker ps
   81  clear
   82  docker ps
   83  docker exec -it  897efea17c0f /bin/bash
   84  docker run -itd ubuntu
   85  docker ps
   86  clear
   87  docker exec -it 9e91e50f937a /bin/bash
   88  clear
   89  docker ps
   90  docker exec 9e91e50f937a git
   91  git
   92  docker exec 9e91e50f937a git
   93  clear
   94  docker ps
   95  docker logs 897efea17c0f
   96  clear
   97  history



    2  docker ps -a
    3  clear
    4  docker ps
    5  docker inspect c682bdbf4e0b
    6  clear
    7  curl http://172.17.0.3
    8  clear
    9  ps -eaf
   10  clear
   11  history









Docker Day 2 Session

Docker Image
===============================
collection of filesystem
		layered over each others

VM Image == Machine Image
BOOTFS + ROOTFS + USERFS + APPS FS + + APPS
Kernel +  Ubuntu + root + Java + Tomcat

ex - iso, ami, vmimage

Docker Image
ROOTFS + USERFS + APPS FS + + APPS
Ubuntu + root + Java + Tomcat

  10  docker images
   11  docker info
   12  clear
   13  docker pull httpd
   14  cd /var/lib/docker/
   15  clear
   16  ls
   17  cd overlay2
   18  ls
   19  du -h --max-depth=1
   20  cd ./ea389c2e7aa25c1d15ad09ebbea8688ed98180f45de506481520e50701ff53d7
   21  clear
   22  ls
   23  cd diff
   24  ls
   25  cd ..
   26  ls
   27  du -h --max-depth=1
   28  cd ./3a1168752426f134f3939fbe5fe1d0fcf29d2177712f3e6199b92e112f833a29
   29  clear
   30  ls
   31  cd diff
   32  ls
   33  cd
   34  clear
   35  doker images
   36  clear
   37  docker images
   38  docker inspect httpd
   39  clear
   40  ls
   41  docker history httpd
   42  cd -
   43  cd ..
   44  clear
   45  ls
   46  cd ..
   47  ls
   48  cd ..
   49  ls
   50  history
=============================================
How to create an image?

Project
=================================
UBUNTU + Update + GIT + Apache + index.html == 	
=========================================
UBUNTU + Update + xammpp + app == devopsschool
=========================================
UBUNTU + Update + JAVA + Tomcat + App = DevOpsX

Method 1 - using container

Method 2 - using dockerfile
----------------------------------------
FROM ubuntu
MAINTAINER Rajesh Kumar
RUN apt-get update
RUN apt-get install git -y
RUN apt-get install apache2 -y
COPY index.html /var/www/html/index.html
ENV JAVA_HOME=/tmp


CMD	- Can be replaced
ENTRYPOINT - cant be replaced
========================================
is used to SET PID 1 for the container.

docker-entrypoint.sh mysqld

=========================================================================


 51  clear
   52  cd
   53  clear
   54  docker run -itd ubuntu
   55  docker ps
   56  docker exec 631a832e87c6 git
   57  docker exec -it 631a832e87c6 /bin/bash
   58  vi index.html
   59  docker cp  631a832e87c6://var/www/html
   60  docker cp  631a832e87c6:/var/www/html
   61  docker cp index.html 631a832e87c6:/var/www/html
   62  clear
   63  ls
   64  docker ps
   65  docker exec 631a832e87c6 git
   66  clear
   67  docker exec 631a832e87c6 which apache2
   68  ls
   69  docker ps
   70  docker commit -m"ub-git-up-apa-in" 631a832e87c6 wizbrand
   71  docker images
   72  docker history ubuntu
   73  docker history wizbrand
   74  clear
   75  docker history wizbrand
   76  clear
   77  ls
   78  vi dockerfile
   79  cleat
   80  clear
   81  docker build -t wizbrand1 .
   82  docker images
   83  docker history wizbrand1
   84  clear
   85  ls
   86  docker images
   87  docker ps
   88  docker run -d httpd
   89  docker ps
   90  clear
   91  docker images
   92  docker run -itd wizbrand1
   93  docker ps
   94  df -kh
   95  docker ps
   96  docker stop 631a832e87c6
   97  docker ps
   98  df -kh
   99  clear
  100  docker run -itd ubuntu
  101  docker ps
  102  docker run -itd ubuntu ls
  103  docker ps
  104  docker ps -a
  105  docker run -it ubuntu ls
  106  clear
  107  docker run -d jenkins/jenkins ls
  108  docker ps -a
  109  docker run -d jenkins/jenkins
  110  docker ps -a
  111  clear
  112  docker run -d mysql
  113  docker ps
  114  clear
  115  docker ps -a
  116  docker run -it d mysql
  117  docker run -itd mysql
  118  docker ps
  119  clear
  120  docker ps -a
  121  docker logs e35f0f657f09
  122  clear
  123  docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag
  124  docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql
  125  docker ps
  126  clear
  127  docker pull xampp/appdocker pull xampp/app
  128  docker pull xampp/app
  129  clear
  130  docker images
  131  docker run -itd xampp/app
  132  docker ps
  133  docker ps  -a
  134  docker logs dc59b8196f45
  135  clear
  136  ocker run --name myXampp -p 41061:22 -p 41062:80 -d -v ~/my_web_pages:/www tomsik68/xampp
  137  docker run --name myXampp -p 41061:22 -p 41062:80 -d -v ~/my_web_pages:/www tomsik68/xampp
  138  docker ps
  139  clear
  140  ls
  141  docker images
  142  docker save -o wizbrand.tar wizbrand1
  143  ls
  144  clear
  145  docker images
  146  docker ps -a
  147  docker container stop $(docker container ls -aq)
  148  docker rm -vf $(docker ps -a -q)
  149  docker rmi -f $(docker images -a -q)
  150  clear
  151  l;s
  152  ls
  153  docker images
  154  docker run -itd ubuntu
  155  clear
  156  docker ps
  157  docker commit -m"demo" -a"rajesh" 9d9493b4f68e rajesh
  158  docker images
  159  docker save -o rajesh.tar rajesh
  160  ls
  161  docker load -i rajesh.tar
  162  docker images
  163  docker tag rajesh devopsschools/nov2023
  164  docker images
  165  docker login
  166  docker push devopsschools/nov2023
  167  clear
  168  history











Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x