-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslideshow.html
2201 lines (1713 loc) · 33.4 KB
/
slideshow.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="keywords" content="remark,remarkjs,markdown,slideshow,presentation" />
<meta name="description" content="A simple, in-browser, markdown-driven slideshow tool." />
<title>Docker 101</title>
<style>
@import url(https://fonts.googleapis.com/css?family=Droid+Sans:regular,700);
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
body {
font-family: 'Droid Sans';
}
h1, h2, h3 {
font-family: 'Yanone Kaffeesatz';
font-weight: 400;
margin-bottom: 0;
}
.remark-slide-content h1 { font-size: 3em; }
.remark-slide-content h2 { font-size: 2em; }
.remark-slide-content h3 { font-size: 1.4em; }
.remark-slide-content {
padding: 0px;
}
.footnote {
position: absolute;
bottom: 3em;
}
li p { line-height: 1.25em; }
.red { color: #fa0000; }
.large { font-size: 2em; }
a, a > code {
color: rgb(249, 38, 114);
text-decoration: none;
}
code {
background: #e7e8e2;
border-radius: 5px;
}
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
.remark-code-line { font-size: 1.4em; }
.remark-code-line-highlighted { background-color: #373832; }
.pull-left {
float: left;
width: 47%;
}
.pull-right {
float: right;
width: 47%;
}
.pull-right ~ p {
clear: both;
}
#slideshow .slide .content code {
font-size: 1.4em;
}
#slideshow .slide .content pre code {
font-size: 0.9em;
padding: 15px;
}
.inverse {
background: #272822;
color: #777872;
text-shadow: 0 0 20px #333;
}
.inverse h1, .inverse h2 {
color: #f3f3f3;
line-height: 0.8em;
}
/* Slide-specific styling */
#slide-inverse .footnote {
bottom: 12px;
left: 20px;
}
#slide-how .slides {
font-size: 0.9em;
position: absolute;
top: 151px;
right: 140px;
}
#slide-how .slides h3 {
margin-top: 0.2em;
}
#slide-how .slides .first, #slide-how .slides .second {
padding: 1px 20px;
height: 90px;
width: 120px;
-moz-box-shadow: 0 0 10px #777;
-webkit-box-shadow: 0 0 10px #777;
box-shadow: 0 0 10px #777;
}
#slide-how .slides .first {
background: #fff;
position: absolute;
top: 20%;
left: 20%;
z-index: 1;
}
#slide-how .slides .second {
position: relative;
background: #fff;
z-index: 0;
}
/* Two-column layout */
.left-column {
color: #777;
width: 25%;
height: 92%;
float: left;
background-color: rgb(39, 40, 34);
padding: 20px;
box-sizing: border-box;
height: 100vh;
}
.left-column h3 {
padding-left: 10px;
}
.left-column h2:last-of-type, .left-column h3:last-child {
color: #f3f3f3;
}
.right-column {
width: 75%;
float: right;
padding-top: 1em;
padding: 20px;
box-sizing: border-box;
height: 100vh;
font-size: 1.4em;
}
.alert {
color: #721c24;
background-color: #f8d7da;
border-color: #f5c6cb;
border-radius: 5px;
padding: 5px;
font-family: 'Ubuntu Mono';
}
.alert p {
margin: 0px;
}
.center {
text-align:center;
}
.info {
color: #0c5460;
background-color: #d1ecf1;
border-color: #f5c6cb;
border-radius: 5px;
padding: 5px;
font-family: 'Ubuntu Mono';
}
.info p {
margin: 0px;
}
table {
border-collapse: collapse;
margin: auto;
}
table, th, td {
padding: 10px;
border: 1px solid black;
}
</style>
</head>
<body>
<textarea id="source">
name: inverse
layout: true
class: center, middle, inverse
---
# Docker 101
Alexandre Kaskasoli and Mohit Gupta
---
# Housekeeping
---
layout: false
.left-column[
## Housekeeping
### - Motivation
]
.right-column[
* We like Docker
* Productivity increase
* "Don't be afraid"
* Little to it for basic usage
]
---
.left-column[
## Housekeeping
### - Motivation
### - Credits
]
.right-column[
https://container.training/
* Lots of good resources
* Inspiration for this workshop
* Take things a step further
]
---
.left-column[
## Housekeeping
### - Motivation
### - Credits
### - Agenda
]
.right-column[
* Why Docker
* Images and Containers
* Docker commands
* Dockerfile
* Docker Compose
* Docker Machine
* Docker Swarm
* Security
]
---
.left-column[
## Housekeeping
### - Motivation
### - Credits
### - Agenda
### - Exercises
]
.right-column[
.center[
https://github.com/Skybound1/docker-workshop-exercises
]
]
---
template: inverse
# Install Docker
---
layout: false
.left-column[
## Install Docker
### - Windows
]
.right-column[
You're on your own
]
---
.left-column[
## Install Docker
### - Windows
### - Linux
]
.right-column[
Most distros will have an antiquated version of Docker, avoid it;
Grab it fresh from Docker repos:
* https://docs.docker.com/engine/installation/#server
* (or Google: `install Docker CE $YOUR_DISTRO`)
* Then
- `pip install docker-compose`
]
---
.left-column[
## Install Docker
### - Windows
### - Linux
### - docker Group
]
.right-column[
* Docker daemon binds to a Unix socket owned by `root`
* `docker` CLI needs access to that socket
* Privs++
]
---
.left-column[
## Install Docker
### - Windows
### - Linux
### - docker Group
]
.right-column[
Two options:
* Prefix all commands by `sudo`
* Or add your user to the `docker` group:
```
$ sudo groupadd docker
$ sudo usermod -aG docker user
# log out and log back in
```
.alert[
Consider members of the `docker` group `root` (when daemon running)
]
]
---
.left-column[
## Install Docker
### - Windows
### - Linux
### - docker Group
### - Verify
]
.right-column[
Check everything works:
```
$ docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
...
```
]
---
template: inverse
# Why Docker?
---
layout: false
.left-column[
## Why Docker?
### - Old Problems
]
.right-column[
* Companies use diff. stacks
* Teams within companies use diff. stacks
* Clients have diff. environments
]
---
layout: false
.left-column[
## Why Docker?
### - Old Problems
### - Legacy Deployments
]
.right-column[
* Code worked on developer's MacBook
* Broke on Linux servers
* Other users can't get it working
* Dependencies need to be re-installed
* Spin up databases and configure services
_Repeat for each ENV_
]
---
.left-column[
## Why Docker?
### - Old Problems
### - Legacy Deployments
### - Shipping Containers
]
.right-column[
Problems solved in other industries:
* Lingo from transport industry
* Standard container size in transport industry
* Same "box" can be loaded on ships, trains or trucks
]
---
.left-column[
## Why Docker?
### - Old Problems
### - Legacy Deployments
### - Shipping Containers
### - Containers for Apps
]
.right-column[
Solution: containers
* Docker containers are _portable app packages_:
- Works on your Dev's MacBook
- Works on your Linux servers
- Works for your users
- Dependencies are packaged into the containers
```
$ git clone tool
$ docker-compose up
# you're done
```
]
---
.left-column[
## Why Docker?
### - Old Problems
### - Legacy Deployments
### - Shipping Containers
### - Containers for Apps
### - Container TL;DR
]
.right-column[
**TL;DR**
.center[
_Containers are file systems sharing your Kernel_
]
.info[
Windows/MacOS - Linux containers run in a Linux VM
]
]
---
template: inverse
# Basics
---
.left-column[
## Basics
### - Images and Containers
]
.right-column[
* An **image** is an inert file system used to spin up containers
* **Containers** are live systems built from images.
| Analogies | Image | Container |
| --------- | ----- | --------- |
| Manufacturing | Blueprint | Thing |
| Programming | Class | Instance |
| Virtualization | ISO | VMs |
* one image → many containers
]
---
.left-column[
## Basics
### - Images and Containers
### - Getting Images
]
.right-column[
* Searching Dockerhub for `alpine` Linux and pulling
```
$ docker search alpine
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
alpine A minimal Docker image based on Alpine Linux… 3024 [OK]
$ docker image pull alpine
```
.alert[
Anyone can put images on Docker Hub;
use "official repositories"
]
* Listing images
```
$ docker image ls | grep alpine
alpine latest 3fd9065eaf02 9 days ago 4.15MB
```
]
---
.left-column[
## Basics
### - Images and Containers
### - Getting Images
### - First Container
]
.right-column[
* Create and run a container with our `alpine` image:
```
$ docker run alpine echo hello world
hello world
```
* Cool. Now list our containers:
```
$ docker ps -a | grep alpine
b39ab8fbb3d0 alpine "echo hello world" 20 seconds ago Exited (0) 19 seconds ago objective_davinci
```
.info[
-a, --all : list all
]
]
---
.left-column[
## Basics
### - Images and Containers
### - Getting Images
### - First Container
]
.right-column[
* Run it again:
```
$ docker run alpine echo hello world
hello world
$ docker ps -a | grep alpine
b39ab8fbb3d0 alpine "echo hello world" 20 seconds ago Exited (0) 19 seconds ago objective_davinci
2324b1d5b9d2 alpine "echo hello world" 38 seconds ago Exited (0) 37 seconds ago ecstatic_poitras
```
* Why do we have two containers?
]
---
.left-column[
## Basics
### - Images and Containers
### - Getting Images
### - First Container
### - Container re-use
]
.right-column[
* Containers *are* re-usable
* but they are *single function*
* Inspect container:
```
$ docker inspect f76f4a6fe596
[
{
"Id": "f76f4a6fe59653e88bee318493009ba87a5b77ca0cae5a13d78067be8f6eeb51",
"Created": "2018-01-17T15:09:40.222945023Z",
"Path": "echo",
"Args": [
"hello",
"world"
],
...
]
```
]
---
.left-column[
## Basics
### - Images and Containers
### - Getting Images
### - First Container
### - Container re-use
]
.right-column[
* When re-used, does the same thing:
```
$ docker start -a f76f4a6fe596
hello world
```
.info[
-a, --attach : attach STDOUT/STDERR
]
To do something else, build new container
]
---
.left-column[
## Basics
### - Images and Containers
### - Getting Images
### - First Container
### - Container re-use
### - Quick Recap
]
.right-column[
.center[
**Quick Recap**
]
* `docker search` searches for images
* `docker image pull` downloads image
]
---
.left-column[
## Basics
### - Images and Containers
### - Getting Images
### - First Container
### - Container re-use
### - Quick Recap
]
.right-column[
.center[
**Quick Recap**
]
* `docker run` creates a new container and runs it
* `docker start` re-runs a container
* `docker ps` lists containers
* `docker inspect` shows container info
]
---
.left-column[
## Basics
### - Images and Containers
### - Getting Images
### - First Container
### - Container re-use
### - Quick Recap
]
.right-column[
.center[
**Quick Recap**
]
.info[
**tip**
* commands that act on _images_ usually start with `docker image`
* commands that act on _containers_ usually just start with `docker`
]
]
---
.left-column[
## Basics
### - Images and Containers
### - Getting Images
### - First Container
### - Container re-use
### - Quick Recap
### - Cleaning Up
]
.right-column[
* List our images
```
$ docker image ls
alpine latest f9b6f7f7b9d3 42 hours ago 1.14MB
```
* Try to delete
```
$ docker image rm alpine
Error response from daemon: conflict: unable to remove repository reference "alpine" (must force) - container 92e35b1165e1 is using its referenced image f9b6f7f7b9d3
```
]
---
.left-column[
## Basics
### - Images and Containers
### - Getting Images
### - First Container
### - Container re-use
### - Quick Recap
### - Cleaning Up
]
.right-column[
* List containers:
```
$ docker ps -a
f76f4a6fe596 alpine "echo hello world" About an hour ago Exited (0) About an hour ago tender_ramanujan
92e35b1165e1 alpine "echo hello world" About an hour ago Exited (0) About an hour ago loving_tereshkova
```
.alert[
Can't delete an image referenced by containers
]
]
---
.left-column[
## Basics
### - Images and Containers
### - Getting Images
### - First Container
### - Container re-use
### - Quick Recap
### - Cleaning Up
]
.right-column[
* Delete our containers:
```
$ docker ps -aq | xargs docker rm
f76f4a6fe596
92e35b1165e1
```
.info[
-q, --quiet : only list container IDs
]
* Now you can delete image:
```
$ docker image rm alpine
Untagged: alpine:latest
Untagged: alpine@sha256:ac2fc418f3348815e68e266a5aa1b60bc522581c96964912560a0baacc4f5c06
Deleted: sha256:f9b6f7f7b9d34113f66e16a9da3e921a580937aec98da344b852ca540aaa2242
Deleted: sha256:779f37a09c897c0406eb0a9fdc3a3eb47f973b03049d215ef7d5cede7c8f24d8
```
]
---
.left-column[
## Basics
### - Images and Containers
### - Getting Images
### - First Container
### - Container re-use
### - Quick Recap
### - Cleaning Up
### - Naming
]
.right-column[
* We used container IDs to refer to our containers
* We can give them names instead
```
$ docker run --name my-container alpine echo hello world
```
.info[
--name : container name
]
```
$ docker inspect my-container
$ docker rm my-container
```
]
---
.left-column[
## Basics
### - Images and Containers
### - Getting Images
### - First Container
### - Container re-use
### - Quick Recap
### - Cleaning Up
### - Naming
### - Exercises
]
.right-column[
.center[
**Exercises**
.center[
https://github.com/Skybound1/docker-workshop-exercises
]
]
]
---
template: inverse
# Checking Inside
---
.left-column[
## Checking Inside
### - Host System
]
.right-column[
* Check out our _host_ distribution:
```
$ cat /etc/lsb-release
LSB_VERSION=1.4
DISTRIB_ID=Arch
DISTRIB_RELEASE=rolling
DISTRIB_DESCRIPTION="Arch Linux"
```
* and _host_ kernel:
```
$ uname -ar
Linux system0 4.14.12-1-ARCH #1 SMP PREEMPT Fri Jan 5 18:19:34 UTC 2018 x86_64 GNU/Linux
```
]
---
.left-column[
## Checking Inside
### - Host System
### - Container System
]
.right-column[
* Same for a Ubuntu container:
```
$ docker search ubuntu
$ docker pull ubuntu
```
* Create container and get shell in it:
```
$ docker run -it ubuntu /bin/bash
root@e650364a5a65:/#
```
.info[
-i, --interactive : redirect STDIN
-t, --tty : pseudo-terminal
]
]
---
.left-column[
## Checking Inside
### - Host System
### - Container System
]
.right-column[
* _Container_ distribution:
```
root@53d9dbca684a:/# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"
```
* "_Container_ kernel":
```
root@53d9dbca684a:/# uname -ar
Linux 53d9dbca684a 4.14.12-1-ARCH #1 SMP PREEMPT Fri Jan 5 18:19:34 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
```
.info[
Container is running a **Ubuntu file system**
has **Ubuntu binaries** and the **Ubuntu repos**
**_but is using the host's kernel_**
]
]
---
.left-column[
## Checking Inside
### - Host System
### - Container System
### - Gotcha
]
.right-column[
* Ubuntu usually ships with `python`, but:
```
root@53d9dbca684a:/# python
bash: python: command not found
```
* Docker images are minimalist
* Shipped with the bare essentials:
```
root@53d9dbca684a:/# dpkg -l | wc -l
101
```
]
---
.left-column[
## Checking Inside
### - Host System
### - Container System
### - Gotcha
### - Exercises
]
.right-column[
.center[
**Exercises**
]
]
---
template: inverse
# Services
---
.left-column[