DevOps – Batch – Aug -2023 – Docker

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
What is Docker?
=============================
	Container mgmt tool.

			1 APP	2 APP	5 APP
	tool		PS ---> 2VS --> 5Container
	- save cost - 	1GB	1GB  --  1GB
	- save time     1 day   5 mn     1 sec
	- imp quality 

	mgmt
	- create - start - stop - restart - pause - up - kill - rm

	Written in Go
	by Docker
	By Soloman Hykes
	Release 
		Community
		Enterprise	
	Version
		24.x

-----------------------------------------------------
	What is Container?
--------------------------------
Container a light weight APP env runtime powered kernal managed by Dockers

Container has
		a user ns
		1 net ns
		1 pidtree ns
		1 mnt ns
		request byd docker to kernal....

=====================================================
VMS ---> VM Image(BOOTFS + ROOTFS + USERFS + APPFS)
Container --> Docker Image (ROOTFS + USERFS + APPFS)
======================================================
IN ORDER TO RUN APP
	HARDWARE
		KERNEL
			NAMESPACE
				USER
				PID
				NET
				MNT (ROOTFS)
			CGROUPS

			Capabilites



Install Docker - \
https://www.devopsschool.com/blog/how-to-install-docker-in-linux/
Docker Tutorials: How to Install Docker in Ubuntu?
Docker architecture ----------------------------------------------- YOU --> Docker Client --> Docker Server --> ContainerD --> Kernel ----------------- Check image in local REPO download it from hub.docker.com =================================== Docker engine Component of Docker ---------------------------- Docker Engine Docker images From Docker Rergistry hub.docker.com Docker Container YOU --> Docker Client --> Docker Server --> ContainerD --> Kernel 1 user 1 net 1 pid tree 1 mount(roofs) from image === container 250 sudo apt-get update 251 sudo apt-get install ca-certificates curl gnupg lsb-release 252 sudo mkdir -p /etc/apt/keyrings 253 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg 254 clear 255 echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 256 sudo apt-get update 257 sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin 258 clear 259 docker 260 clear 261 docker info 262 clear 263 docker version 264 which docker 265 which dockerd 266 which containerd 267 ps -eaf | grep docker 268 ps -eaf | grep containers 269 ps -eaf | grep containerd 270 history ============================================ ========================================================== 209 ls 210 docker ps 211 docker ps -a 212 docker images 213 docker pull httpd 214 clear 215 docker images 216 docker ps 217 docker ps -a 218 docker create httpd\ 219 docker create httpd 220 docker ps -a 221 docker create httpd 222 clear 223 docker ps -a 224 docker start bfe559b0cfb4 225 docker ps -a 226 docker start crazy_gould 227 docker ps -a 228 docker stop bfe559b0cfb4 229 clear 230 docker ps -a 231 docker restart 3f6c93e0de8a 232 docker ps -a 233 clea 234 clear 235 docker ps -a 236 docker pause 3f6c93e0de8a 237 docker ps -a 238 docker stats 239 docker ps -a 240 docker unpause 3f6c93e0de8a 241 docker ps -a 242 clear 243 docker ps -a 244 docker kill 3f6c93e0de8a 245 docker ps -a 246 docker rm bfe559b0cfb4 3f6c93e0de8a 247 clear 248 docker ps -a ========================================= How to consume Container? ===================================== --- Using SHELL 258 docker exec -it 1c15c991569f /bin/bash 259 docker exec 1c15c991569f ls --- Using Network 263 docker inspect 1c15c991569f 264 curl http://172.17.0.2 ============================================== RUN ================================ pull + create + start + attach to a pid1 of the cont. ============================================== RUN -d ================================ pull + create + start + DO NOT attach to a pid1 of the cont. ================================== 268 docker ps 269 docker attach 1c15c991569f 270 docker ps 271 docker ps -a 272 clear 273 docker run httpd 274 docker run -d httpd 275 docker ps docker run -d -p 80:80 httpd docker run -d -p 82:80 httpd 208 clear 209 docker run -d -p 80:80 httpd 210 docker run -d -p 81:80 httpd 211 netstat tulpn 212 netstat -tulpn 213 netstat 214 clear 215 docker run -d -p 82:80 httpd 216 docker ps 217 clear 218 docker ps ================================================= How to create an Docker Images ======================================== ================================================================== What is Docker Image -------------------------- collection of filesystem ---------------------------------- UBUNTU + JAVA + GIT + Apache2 ----------------------------- M 1- Using Existing Container 1 clear 2 apt-get install git 3 apt-get update 4 clear 5 ls 6 apt-get install git -y 7 git 8 clear 9 java 10 apt-get install openjdk-11-jdk -y 11 clear 12 java 13 cler 14 clea 15 clear 16 apt-get install apache2 17 git 18 java 19 which apache2 20 history ======================= 278 docker run -itd ubuntu 279 docker ps 280 clear 281 docker exec -it b96bcff46a70 /bin/bash 282 clear 283 docker history httpd 284 clear 285 ls 286 docker images 287 docker ps 288 docker exec b96bcff46a70 git 289 docker exec b96bcff46a70 java 290 docker exec b96bcff46a70 which apache2 291 clear 292 docker ps 293 docker history ubuntu 294 docker commit -m"ub-up-ap-java-git" -a"Rajesh Kumar" b96bcff46a70 ub-up-ap-java-git 295 docker images 296 clear 297 docker images 298 docker history ubuntu 299 docker history ub-up-ap-java-git 300 docker run -itd 04aeb5947f09 301 docker ps 302 docker images 303 docker run -itd ub-up-ap-java-git 304 docker images 305 docker ps 306 docker exec d95a3ad3b8da java 307 history 308 docker history ub-up-ap-java-git 309 history ============================================== https://hub.docker.com/r/devopsschools/sataug2023 310 clear 311 docker images 312 docker into 313 docker info 314 clear 315 cd /var/lib/docker 316 ls 317 cd overlay2 318 ls 319 clear 320 ls 321 clear 322 cd 323 clear 324 ls 325 docker images 326 docker save -o ub-up-ap-java-git.tar ub-up-ap-java-git 327 ls 328 docker images 329 docker run -itd ubuntu 330 docker exec -it 1ad086930a58b318351ec3234791452f35ce66debf2e0bf1bf105d78678015e0 331 docker exec -it 1ad086930a58b318351ec3234791452f35ce66debf2e0bf1bf105d78678015e0 /bin/bash 332 clear 333 ls 334 docker ps 335 docker commit -m"hello world" -a"Rajesh Kumar" ubhello 1ad086930a58 336 docker commit -m"hello world" -a"Rajesh Kumar" 1ad086930a58 ubhello 337 clear 338 docker images 339 docker tag ubhello devopsschools/sataug2023 340 docker images 341 docker login 342 clear 343 docker images 344 docker push devopsschools/sataug2023 345 history =================================================== Dockerfile ------------------------------------------- FROM ubuntu MAINTAINER Rajesh Kumar DevOps@rajeshkumar.xyz RUN apt-get update RUN apt-get install apache2 -y RUN apt-get install git -y COPY snap.tar /tmp ENV JAVA_HOME /opt/java Refr - https://github.com/jenkinsci/docker/blob/587b2856cd225bb152c4abeeaaa24934c75aa460/Dockerfile https://github.com/CentOS/sig-cloud-instance-images/blob/b2d195220e1c5b181427c3172829c23ab9cd27eb/docker/Dockerfile
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