forked from RAHAMSHAIK007/10-03amnew
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path6. DOCKER
1021 lines (872 loc) · 29 KB
/
6. DOCKER
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
MONOLITHIC : Single server multiple services single DB.
MICRO SERVICE : Multiple servers Multiple services with multiple DB's
how to select the architecture: Based on application and its services.
in Micro services we dont use servers, we use Containers.
Container: is a Virtual Machine without OS.
Docker: its a tool used to create Container.
Image: consist of os & packages which are already installed.
server = Vm = conatiner
Docker:
It is an open source centralized platform designed to create, deploy and run applications.
Docker is written in the Go language.
Docker creates containers on host O.S to run applications. (computer/server os)
We can install Docker on any O.S but the docker engine runs natively on Linux distribution.
It allows applications to use the same Linux kernel as a system on the host computer, rather than creating a whole virtual O.S.
Before Docker Docker performs O.S level Virtualization also known as Containerization.
process of packing application along with its dependencies.
many users face problems that a particular code is running in the developer’s system but not in the user system.
It was initially released in March 2013, and developed by Solomon Hykes and Sebastian Pahl.
Docker is a set of platform-as-a-service that use O.S level Virtualization, where as VM ware uses Hardware level Virtualization.
Container have O.S files but its negligible in size compared to original files of that O.S.
COMPONENTS:
CLIENT: It takes the commands and executes with communication docker daemon
HOST: The place where you installed docker.
DAEMON: Deals with docker componets(images, containers, volumes ----). it is inside docker host.
REGISTRY: It stores all the Images.
============================================
DAY-02:
Installation:
yum install docker -y
systemctl restart docker.service
systemctl status docker.service
docker version
DOCKER COMMANDS:
docker pull ubuntu: to get ubuntu image from registry
docker images : to list the images
docker run ubuntu : to create a conatiners
docker ps -a : to list all the containers
docker ps : to list running containers only
docker run --name raham1 ubuntu : to give the name for container
docker run -it --name raham2 ubuntu : to go inside of a container
(it = interactive terminal, will go inside container, -d means detach mode will not go inside the container)
cat /etc/os-release : to see the flavour of linux
docker inspect cont-name : to see the full infromation of a container.
docker attach cont-name : to go inside the container.
inside container: note: in ubuntu pkg manager is apt (advance package tool)
apt update -y
apt install maven -y
apt install mysql-server -y
mkdir raham & touch abc.txt
raham2 (cont) -- > install maven,mysql db & files -- > image form container -- > image
os level of virtualization --- > content inside the os will be on image now
ctrl p q : to exit from container
docker commit raham2 swiggy:v1 : to create image from container
====================================================================================
DOCKER FILE:
It is an automated method to create docker images.
in docker file D must be captial.
in single folder we need to have only one docker file.
docker file will have some componets inside it.
each component is on CAPITAL letter.
write Docker file -- > Build -- > Image
docker build -t image-name .
FROM : Used for base image
RUN : Used to execute commands (During image creation)
CMD : Used to execute commands (During Container creation)
COPY : used to copy local files to container
ADD : used to files on internet to container & used for exctraction of files.
WORKDIR : Takes you to the desried directory ( defaut / = /tmp)
LABEL : Used to attach labels to containers like email, author ----
ENV : To pass environment variables (inside the containers)
args : to pass value (outside of container)
EXAMPLE-1:
FROM ubuntu
RUN apt update -y
RUN apt install maven -y
RUN mkdir raham
RUN touch raham/abc.txt
================================================
EXAMPLE-2:
FROM ubuntu
RUN apt update -y
RUN apt install maven -y
RUN mkdir raham
RUN touch raham/abc.txt
COPY index.html /tmp
COPY apache-maven-3.6.3-bin.tar.gz /tmp
ADD https://dlcdn.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz /opt
=======================================================
EXAMPLE-3:
FROM ubuntu
RUN apt update -y
RUN apt install maven -y
RUN mkdir raham
RUN touch raham/abc.txt
WORKDIR /tmp
==========================
EXAMPLE-4:
FROM ubuntu
RUN apt update -y
RUN apt install maven -y
RUN mkdir raham
RUN touch raham/abc.txt
LABEL user raham
ENV client swiggy
HISTORY:
1 yum install docker -y
2 systemctl restart docker.service
3 systemctl status docker.service
4 docker -v
5 docker version
6 docker pull ubuntu
7 docker images
8 docker run ubuntu
9 docker ps -a
10 docker run --name raham1 ubuntu
11 docker ps -a
12 docker run -it --name raham2 ubuntu
13 docker ps -a
14 docker ps
15 docker commit raham2 swiggy:v1
16 docker images
17 docker run -it --name raham3 swiggy:v1
18 ll
19 vim Dockerfile
20 docker build -t swiggy:v2 .
21 cat Dockerfile
22 docker images
23 docker ps -a
24 docker run -it --name raham4 swiggy:v1 /bin/bash
25 docker run -it --name raham5 swiggy:v2 /bin/bash
26 vim Dockerfile
27 docker build -t swiggy:v2 .
28 docker run -it --name raham6 swiggy:v2 /bin/bash
29 docker run -it --name raham7 swiggy:v2
30 mysql --version
31 vim index.html
32 ll
33 vim Dockerfile
34 wget https://dlcdn.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
35 ll
36 vim Dockerfile
37 docker build -t swiggy:v3 .
38 ll
39 vim Dockerfile
40 docker build -t swiggy:v3 .
41 docker run -it --name raham8 swiggy:v3
42 docker ps -a
43 docker start raham8
44 docker ps -a
45 vim Dockerfile
46 docker run -it --name raham8 swiggy:v3
47 docker build -t swiggy:v3 .
48 docker run -it --name raham9 swiggy:v3
49 vim Dockerfile
50 docker build -t swiggy:v3 .
51 docker run -it --name raham10 swiggy:v1
52 docker run -it --name raham11 swiggy:v3
53 vim Dockerfile
54 docker build -t swiggy:v3 .
55 docker images
56 docker ps -a
57 docker inspect raham11
58 docker run -itd --name raham12 swiggy:v3
59 dockr ps -a
60 dockrr ps -a
61 docker ps -a
62 docker inspect raham12
63 docker inspect raham12 | grep -i label
64 docker inspect raham12 | grep -i labels
65 docker inspect raham12 | grep -i raham
66 vim Dockerfile
67 docker build -t swiggy:v3 .
68 docker run -itd --name raham13 swiggy:v3
69 docker ps -a
70 docker attach raham13
71 docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag
72 docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:8.0.33
73 docker ps -a
74 history
=============================================================================================================================================================
DAY-03:
VOLUMES:
By default when we create a volume the data is also going store on host.
PART-1 (CONT -- > CONT)
1. DOCKER FILE
FROM ubuntu
VOLUME ["/volume1"]
docker build -t raham:v1 .
docker run -it --name cont1 raham:v1
crerate some files inside cont-1
docker run -it --name cont2 --volumes-from=cont1 --privileged=true ubuntu
2. FROM RUNTIME
docker run -it --name cont3 -v volume2 ubuntu
cd volume2 -- > create some files
docker run -it --name cont4 --volumes-from=cont3 --privileged=true ubuntu
3. FROM COMMANDS (Volume Mounting)
docker volume ls
docker volume create raham1
docker volume inspect raham1
cd /var/lib/docker/volumes/raham1/_data
create some files
docker run -it --name cont5 --mount source=raham1,destination=/raham1 ubuntu
PART-2: (CONT -- > LOCAL)
CONT --- > CONT COPIED THE FILES
I WANT TO COPY CONTENT FROM CONTAINER TO MY LOCAL
docker volume ls
docker volume inspect raham1
cd /var/lib/docker/volumes/raham1/_data
cp * -R /root/
PART-3: (LOCAL -- > CONT)
1. Dockerfile
2.
cd /home/ec2-user
touch file{1..5}
docker run -it --name cont7 -v /home/ec2-user:/xyz ubuntu
cd /xyz -- > 11 -- > create files -- > local -- >
================================================================================
DOCKER SYSTEM COMMANDS: To show the memory utilization of Docker Components.
docker info
docker system df
docker system df -v
docker system prune --all : Remove all unused images not just dangling ones
docker system prune --force: Do not prompt for confirmation
docker system prune --volumes : To remove unused volumes
==========================================================================
JENKINS SETUP USING DOCKER IMAGES:
docker run -it --name jenkins jenkins/jenkins:lts
==========================================================================
DEPLOYMENT:
vim Dockerfile
FROM ubuntu
RUN apt-get update -y
RUN apt-get install apache2 -y
COPY index.html /var/www/html/
CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
docker build -t image:v1 .
docker run -itd --name app1 -p 82:80 image
82: container port & 80: image port (installed httpd -- > 80)
index.html:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {font-family: Arial, Helvetica, sans-serif;}
/* Full-width input fields */
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
/* Set a style for all buttons */
button {
background-color: #04AA6D;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
button:hover {
opacity: 0.8;
}
/* Extra styles for the cancel button */
.cancelbtn {
width: auto;
padding: 10px 18px;
background-color: #f44336;
}
/* Center the image and position the close button */
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
position: relative;
}
img.avatar {
width: 40%;
border-radius: 50%;
}
.container {
padding: 16px;
}
span.psw {
float: right;
padding-top: 16px;
}
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
padding-top: 60px;
}
/* Modal Content/Box */
.modal-content {
background-color: #fefefe;
margin: 5% auto 15% auto; /* 5% from the top, 15% from the bottom and centered */
border: 1px solid #888;
width: 80%; /* Could be more or less, depending on screen size */
}
/* The Close Button (x) */
.close {
position: absolute;
right: 25px;
top: 0;
color: #000;
font-size: 35px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: red;
cursor: pointer;
}
/* Add Zoom Animation */
.animate {
-webkit-animation: animatezoom 0.6s;
animation: animatezoom 0.6s
}
@-webkit-keyframes animatezoom {
from {-webkit-transform: scale(0)}
to {-webkit-transform: scale(1)}
}
@keyframes animatezoom {
from {transform: scale(0)}
to {transform: scale(1)}
}
/* Change styles for span and cancel button on extra small screens */
@media screen and (max-width: 300px) {
span.psw {
display: block;
float: none;
}
.cancelbtn {
width: 100%;
}
}
</style>
</head>
<body>
<h2>DevOps By Raham V:2.0</h2>
<button onclick="document.getElementById('id01').style.display='block'" style="width:auto;">Login</button>
<div id="id01" class="modal">
<form class="modal-content animate" action="/action_page.php" method="post">
<div class="imgcontainer">
<span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">×</span>
<img src="img_avatar2.png" alt="Avatar" class="avatar">
</div>
<div class="container">
<label for="uname"><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="uname" required>
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required>
<button type="submit">Login</button>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>
<div class="container" style="background-color:#f1f1f1">
<button type="button" onclick="document.getElementById('id01').style.display='none'" class="cancelbtn">Cancel</button>
<span class="psw">Forgot <a href="#">password?</a></span>
</div>
</form>
</div>
<script>
// Get the modal
var modal = document.getElementById('id01');
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
</body>
</html>
HISTORY:
1 yum install docker -y
2 docker pull ubuntu
3 docker version
4 docker images
5 systemctl status docker
6 systemctl start docker
7 systemctl status docker
8 docker images
9 docker pull ubuntu
10 vim Dockerfile
11 docker images
12 docker build -t raham:v1 .
13 docker images
14 docker run -it --name cont1 raham:v1
15 docker ps -a
16 docker run -it --name cont2 --volumes-from=cont1 --privileged=true ubuntu
17 docker ps -a
18 docker attach cont1
19 cat Dockerfile
20 docker run -it --name cont3 -v volume2 ubuntu
21 docker run -it --name cont4 --volumes-from=cont3 --priviliged=true ubuntu
22 docker ps -a
23 docker run -it --name cont4 --volumes-from=cont3 --privileged=true ubuntu
24 docker attach cont3
25 docker volumes ls
26 docker volume ls
27 docker volume create raham1
28 docker volume ls
29 docker inspect cont1
30 docker volume inspect raham1
31 cd /var/lib/docker/volumes/raham1/_data
32 ll
33 touch mountfiles{1..5}
34 vim mountfiles1
35 docker run -it --name cont5 --mount source=raham1,destination=/raham1 ubuntu
36 ll
37 docker run -it --name cont6 --mount source=raham1,destination=/abcd ubuntu
38 LL
39 ll
40 cp * -R /root/
41 cd /root/
42 ll
43 docker volume ks
44 docker volume ls
45 docker volume inspect raham1
46 cd /var/lib/docker/volumes/raham1/_data
47 ll
48 CD
49 cd
50 cd /home/ec2-user/
51 ll
52 ls -al
53 touch hostfiles{1..5}
54 ll
55 docker ps
56 pwd
57 ls
58 docker run -it --name cont7 -v /home/ec2-user:/xyz ubuntu
59 ll
60 docker info
61 docker system
62 docker system df
63 docker volume create raham2
64 docker system df
65 cd
66 docker system df -v
67 docker run -it --name cont6 --mount source=raham1,destination=/abcdef ubuntu
68 docker pull jenkins/jenkis:lts
69 docker pull jenkins/jenknis:lts
70 docker pull jenkins/jenkins:lts
71 docker pull centos:latest
72 docker pull amazonlinux:latest
73 docker system df -v
74 docker system prune
75 docker system df -v
76 docker system prune
77 docker system df -v
78 docker system
79 docker system COMMAND --help
80 docker system prune --help
81 docker system prune --volumes
82 docker system prune --images
83 docker system prune --all
84 docker images
85 docker run -it --name jenkins jenkins/jenkins:lts
86 docker images
87 docker pull jenkins/jenkins:lts-jdk11
88 docker images
89 docker run -it --name jenkins1 jenkins/jenkins:lts-jdk11
90 docker pull jenkins/jenkins:2.401.1-lts-jdk11
91 docker run -it --name cont8 jenkins/jenkins:2.401.1-lts-jdk11
92 docker run -it --name cont9 -p 8080:8080 jenkins/jenkins:2.401.1-lts-jdk11
93 docker images
94 docker ps -a
95 ll
96 rm -rf *
97 vim Dockerfile
98 vim index.html
99 docker build -t r:v1 .
100 docker run -itd --name app1 -p 80:90 r:v1
101 docker ps -a
102 docker run -itd --name app1 -p 90:80 r:v1
103 docker run -itd --name app2 -p 90:80 r:v1
104 docker stop app1 app2
105 docker rm app1 app2
106 docker run -itd --name app1 -p 80:80 r:v1
107 docker ps -a
108 docker run -itd --name app1 -p 81:80 r:v1
109 docker run -itd --name app2 -p 81:80 r:v1
110 docker run -itd --name app3 -p 82:80 r:v1
111 cat Dockerfile
====================================================================================================
DAY-04:
DOCKER COMPOSE: Its a tool on docker used to create multiple containers at a single time.
COMPOSE FILE: we will give the infromation of the containers (Image, Port, Volume -----)
it is on YAML Format Which works on KEY-VALUE Pair.
HOW IT WORKS:
IMAGE -- > DOCKER FILE & INDEX.HTML
CONTAINER -- > COMPOSE.YML
Dockerfile
FROM ubuntu
RUN apt update -y
RUN apt install apache2 -y
COPY index.html /var/www/html
CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
docker-compose.yml
version: '3'
services:
train:
image: train:v1
ports:
- "8000:80"
volumes:
- "trainvolume"
movies:
image: movies:v1
ports:
- "8001:80"
volumes:
- "movievolume"
recharge:
image: recharge:v1
ports:
- "8002:80"
volumes:
- "rechargevolume"
COMMANDS:
docker-compose ps
docker-compose stop
docker-compose start
docker-compose pause
docker-compose unpause
docker-compose down (stop -- > delete)
docker-compose up -d
docker-compose top
docker-compose images
docker-compose logs
DOCKER HUB: To store our images on central
1. CREATE IMAGE & REPO
2. TAG IMAGE (docker tag recharge:v1 apn2993/paytm)
3. docker login (username & password)
4. docker push apn2993/paytm
NOTE: DockerHub will support only image for one repo.
NETWORK:
Docker networks are used to make a communication between the multiple containers that are running on same or different docker hosts. We have different types of docker networks.
Bridge Network
Host Network
None network
Overlay network
BRIDGE NETWORK: It is a default network that container will communicate with each other within the same host.
HOST NETWORK: When you Want your container IP and ec2 instance IP same then you use host network
NONE NETWORK: When you don’t Want The container to get exposed to the world, we use none network. It will not provide any network to our container.
OVERLAY NETWORK: Used to communicate containers with each other across the multiple docker hosts.
To create a network: docker network create network_name
To see the list: docker network ls
To delete a network: docker network rm network_name
To inspect: docker network inspect network_name
To connect a container to the network: docker network connect network_name container_id/name
apt install iputils-ping -y : command to install ping checks
To disconnect from the container: docker network disconnect network_name container_name
To prune: docker network prune
HISTORY:
12 yum install docker -y
13 systemctl start docker
14 systemctl status docker
15 yum install docker-compose -y
16 sudo curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
17 ls /usr/local/bin/
18 sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
19 sudo chmod +x /usr/local/bin/docker-compose
20 docker-compose version
21 vim docker-compose.yml
22 vim Dockerfile
23 vim index.html
24 docker build -t train:v1 .
25 vi docker-compose.yml
26 docker-compose up -d
27 docker ps
28 vim docker-compose.yml
29 vim index.html
30 docker build -t movies:v1 .
31 vim docker-compose.yml
32 docker-compose up -d
33 docker ps
34 vim index.html
35 docker build -t recharge:v1 .
36 vim docker-compose.yml
37 docker-compose up -d
38 docker ps
39 cat Dockerfile
40 cat docker-compose.yml
41 docker-compose ps
42 docker images
43 docker-compose images
44 docker-compose logs
45 docker-compose events
46 docker-compose ps
47 docker-compose stop
48 docker-compose ps
49 docker-compose start
50 docker-compose pause
51 docker-compose unpause
52 docker-compose down4
53 docker-compose down
54 docker-compose ps
55 docker-compose up -d
56 docker-compose ps
57 docker-compose scale root_movies_1 --replicas=2
58 docker-compose up -d --scale=2
59 docker-compose up -d --scale movies=5
60 docker-compose ports
61 docker-compose port
62 docker-compose ls
63 docker-compose top
64 docker-compose service ls
65 docker-compose service
66 docker-compose services
67 docker-compose config
68 docker images
69 docker tag apn2993/paytm recharge:v1
70 docker tag recharge:v1 apn2993/paytm
71 docker images
72 docker push apn2993/paytm
73 docker login
74 docker push apn2993/paytm
75 docker images
76 docker tag movies:v1 apn2993/abcd
77 docker images
78 docker push apn2993/abcd
79 docker inspect movies:v1
80 docker system df -v
81 docker network ls
82 docker ps
83 docker network ls
84 docker inspect 48da4552b779
85 docker ps
86 docker inspect e7b7cb67ef74
87 docker inspect e7b7cb67ef74 | grep -i network
88 docker network ls
89 docker network create paytm
90 docker network ls
91 docker network inspect paytm
92 docker ps -a
93 docker network inspect paytm
94 docker network ls
95 docker ps
96 docker network connect paytm e7b7cb67ef74
97 docker network inspect paytm
98 docker network connect paytm f5451a51caed
99 docker network inspect paytm
100 docker network rm paytm
HISTORY:
2 yum install docker -y
13 systemctl start docker
14 systemctl status docker
15 yum install docker-compose -y
16 sudo curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
17 ls /usr/local/bin/
18 sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
19 sudo chmod +x /usr/local/bin/docker-compose
20 docker-compose version
21 vim docker-compose.yml
22 vim Dockerfile
23 vim index.html
24 docker build -t train:v1 .
25 vi docker-compose.yml
26 docker-compose up -d
27 docker ps
28 vim docker-compose.yml
29 vim index.html
30 docker build -t movies:v1 .
31 vim docker-compose.yml
32 docker-compose up -d
33 docker ps
34 vim index.html
35 docker build -t recharge:v1 .
36 vim docker-compose.yml
37 docker-compose up -d
38 docker ps
39 cat Dockerfile
40 cat docker-compose.yml
41 docker-compose ps
42 docker images
43 docker-compose images
44 docker-compose logs
45 docker-compose events
46 docker-compose ps
47 docker-compose stop
48 docker-compose ps
49 docker-compose start
50 docker-compose pause
51 docker-compose unpause
52 docker-compose down4
53 docker-compose down
54 docker-compose ps
55 docker-compose up -d
56 docker-compose ps
57 docker-compose scale root_movies_1 --replicas=2
58 docker-compose up -d --scale=2
59 docker-compose up -d --scale movies=5
60 docker-compose ports
61 docker-compose port
62 docker-compose ls
63 docker-compose top
64 docker-compose service ls
65 docker-compose service
66 docker-compose services
67 docker-compose config
68 docker images
69 docker tag apn2993/paytm recharge:v1
70 docker tag recharge:v1 apn2993/paytm
71 docker images
72 docker push apn2993/paytm
73 docker login
74 docker push apn2993/paytm
75 docker images
76 docker tag movies:v1 apn2993/abcd
77 docker images
78 docker push apn2993/abcd
79 docker inspect movies:v1
80 docker system df -v
81 docker network ls
82 docker ps
83 docker network ls
84 docker inspect 48da4552b779
85 docker ps
86 docker inspect e7b7cb67ef74
87 docker inspect e7b7cb67ef74 | grep -i network
88 docker network ls
89 docker network create paytm
90 docker network ls
91 docker network inspect paytm
92 docker ps -a
93 docker network inspect paytm
94 docker network ls
95 docker ps
96 docker network connect paytm e7b7cb67ef74
97 docker network inspect paytm
98 docker network connect paytm f5451a51caed
99 docker network inspect paytm
100 docker network rm paytm
==================================================================
DAY-05:
SWARM: Used to manage contaienrs on multiple servers.
MASTER: Used to create and distribute the containers.
WORKER: Used to Store container.
NOTE: To work with DS we need to enable Docker Engine.
If we delete one container it will create onother.
CLUSTER: Group of servers.
REPLICA: Copy of the Conatiner.
STEP-1: CRAETE 3 SERVERS (1 MANAGER, 2 WORKERS)
STEP-2: SET HOSTNAMES (hostnamectl set-hostname manager/worker1/worker2) && sudo -i
STEP-3: INSTALL AND START DOCKER
STEP-4: SETUP A CLUSTER (Manager -- > token -- > copy to worker node)
docker swarm init --advertise-addr 172.31.87.191 (PRIVATE IP)
docker node ls : TO list number of worker nodes
docker service create --name paytm --publish 81:80 --replicas 3 rahamshaik/paytmmsmovies:latest
docker sevice ls : To list the services
docker service scale paytm=10 : To scale the services
docker service ps paytm : To list containers of Paytm Service only
docker service inspect paytm : To get the complet info of service
docker service update --image rahamshaik/nitdevops:latest paytm : To update the image
docker service rollback paytm : To Rollback
HISTORY:
1 yum install docker -y
2 service docker start
3 service docker status
4 docker swarm init --advertise-addr 172.31.87.191
5 docker node ls
6 docker ps -a
7 docker run -itd --name cont1 rahamshaik/paytmmsmovies:latest
8 docker ps -a
9 docker stop 5b22923a6a1e
10 docker rm 5b22923a6a1e
11 docker ps -a
12 docker service create --name paytm -p 80:80 --replicas 3 rahamshaik/paytmmsmovies:latest
13 docker ps
14 docker service create --name paytm --publish 81:80 --replicas 3 rahamshaik/paytmmsmovies:latest
15 docker service ls
16 docker stop 1xiwvb7dqmb4
17 docker service rm 1xiwvb7dqmb4
18 docker service ls
19 docker service create --name paytm --publish 81:80 --replicas 3 rahamshaik/paytmmsmovies:latest
20 docker ps
21 docker service ls
22 docker service scale paytm=6
23 docker service ls
24 docker ps
25 docker service scale paytm=10
26 docker service ls
27 docker service paytm ps
28 docker service ps paytm
29 docker service scale paytm=3
30 docker service ps paytm
31 docker ps
32 docker stop 42f790d5d69a
33 docker rm 42f790d5d69a
34 docker ps
35 docker stop 015cee27558f
36 docker rm 015cee27558f
37 docker ps
38 docker run -itd --name cont1 ubuntu
39 docker ps
40 docker stop 39ce6ef358f4
41 docker rm 39ce6ef358f4
42 docker ps
43 docker service ls
44 docker service inspect paytm
45 docker service update --image rahamshaik/paytmmsdth:latest paytm
46 docker ps -a
47 docker service ls
48 docker service update --image rahamshaik/nitdevops:latest paytm
49 docker service ls
50 docker service rollback paytm
51 docker service logs paytm
52 history
=========================================
DAY-07:
docker run -dit --name cont_name --memory=250m --cpus="0.25" image_name
to check: docker inspect cont_name | grep -i memory
to check: docker inspect cont_name | grep -i cpus
HISTORY:
57 curl -L https://downloads.portainer.io/ce2-16/portainer-agent-stack.yml -o portainer-agent-stack.yml
58 ll
59 vim portainer-agent-stack.yml
60 docker stack ls
61 ls
62 docker stack deploy -c portainer-agent-stack.yml protainer
63 docker stack ls
64 docker ps
65 docker stack ls
66 docker stack ps courses
67 docker stack ps courses | grep -i Running
68 docker stack ps portainer | grep -i Running
69 docker stack ps protainer | grep -i Running
70 docker volume ls
71 docker service ls
72 docker ps -a
73 docker stack ls
74 docker ps
75 docker stop 346ceea27e06
76 docker rm 346ceea27e06
77 docker ps
78 docker stack ls
79 docker stack isspect courses
80 docker stack inspect courses