aboutsummaryrefslogtreecommitdiff
path: root/slides.md
blob: 2fc494aa75ec623fc70daa38cde61f818f926e98 (plain)
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
%title: Docker for Homo Troglodytes
%author: Cody Hiar
%date: 2019-01-15

-> Docker for Homo Troglodytes <-
=================================

-------------------------------------------------

# About Me

* Graduated Computer Engineering at U of A
* Now working remotely @ Blendable
* Vim/Tmux Diehard, also cli in general
* Interests: Python, Automation, DevOps, Linux

# Where I be

* www.codyhiar.com
* www.github.com/thornycrackers

# Past Presentations (available on GitHub)

* Scraping with scrapy (YEGSEC)
* Python Daemons (Edmonton.py)
* Setting Django up on a VPS (Edmonton.py)

-------------------------------------------------

-> My Goals <-
==============

* Help build a mental model of Docker
* Introduce Docker basics
* Give some working examples for possibilites

-> My Assumptions <-
====================

* You know what the concept of a VM is 
* Little to no experience with Docker
* You know _some_ linux
* Take things with a grain of salt

-------------------------------------------------

-> What is Docker? <-
====================

```
Docker == VM      // True
Docker === VM     // False
```

^

For all intents and purposes, you can use your
mental model of a VM for Docker.  Some people will
argue that there is a difference, usually their
answers are ostentatious.

-------------------------------------------------

Handy Chart of Advantages
=========================

| Feature     | VM | Docker |
| ----------- | -- | ------ |
| Size        | **  |   **    |
| Startup     | **  |   **    |
| Integration | **  |   **    |

Docker vs Vagrant
MBs vs GBs
Seconds vs Minutes


-------------------------------------------------

-> Installation <-
==================

- Mac/Windows https://www.docker.com/get-started
- Linux:
    https://www.digitalocean.com/community/tutorials
    /how-to-install-and-use-docker-on-ubuntu-16-04

(Article includes CentOs 7, Debian 9, Ubuntu 18.04)

-------------------------------------------------

-> Pfffft Let's see it <-
=========================

example1.sh demo

- Run script 
- Explain commands
- Look at execution time
- Look at image size

-------------------------------------------------

-> What Happened? <-
====================

> "What goes up must come down" -Isaac Newton

1. Docker looked for image (Downloads if needed)
2. Docker spins up a container
3. Container runs `echo Hello World`
4. Docker spins down the container
4. Docker removed the container

There will be no demo of a VM time equivalent

-------------------------------------------------

Q: If the time difference between running a command
on the machine and running a command in a
container is negligible, then why don't we start
running all commands inside of containers?

-------------------------------------------------

A: We don't understand Docker yet. But after
this we will!

-------------------------------------------------

-> Let's dockerize the 'date' command <-
========================================

example2.sh demo

- show `date` command
- show script with docker command explain '$@' args
- run `date -d yesterday` locally and with script
- move script to somewhere on $PATH to execute

-------------------------------------------------

As you can see the run time of the command inside
the container is blazingly fast. `date` was already built
into the container so look at how to install a package.

-------------------------------------------------

-> Introducting Docker Files <-
===============================

Docker images are synonymous with VM snapshots. They take a
'picture' of the current container. While it is possible to
start a container, install/set it up, and then export the
container as an image, the best way to create images is by
using a Dockerfile. Dockerfiles are step by step set of
instructions on how to create an image that will be able to
run an application. 

-------------------------------------------------

-> Let's dockerize Vim <-
=========================

example3.sh demo

- Show Dockerfile
- Show script, explain docker build
- Explain layers for caching and build context
- Explain the volumes for mounting files

-------------------------------------------------

-> A Quick Intermission: <-
===========================
-> Compiled vs Intepreted Programming Languages <-
==================================================

Once upon a time, programming langauges were compiled to
binaries and everyone was happy. Then the evil Alan Kay
led the creation of Smalltalk at Xerox PARC which influenced
future programming languages with evil concepts like object
oriented programming and compiling at run time. Now we have
to live with the evil Alan Kay's cruel intentions and will
never know true happiness again.

The End

-------------------------------------------------

-> Using language specific images <-
====================================

Some langauges, such as python, ruby, and javascript,
are compiled at run time when they are run. This means that
you need to have that language's ecosystem installed on your
machine to run a tool programmed in that language. Docker
provides official images for many languages which provide
required low level libraries and usually the languages
package manager so that you can quickly get up and running.
Now we don't have to pick tools based on their languages.

-------------------------------------------------

-> Let's dockerize Babysploit <-
================================

example4.sh demo

- Babysploit provides own container, we'll try our own
- Show Dockerfile and script

-------------------------------------------------

-> A Beginner's Summary <-
==========================

- We have a loose general idea of what Docker is
- We've seen how fast/small docker images are
- We have a framework for running images similar to binaries
- Dockerfiles provide us with step by step instructions on
    how to build the environment for an application as well
    as define the boundaries of an application
- We can use tools written in languages we don't know
    without having to research how to set the the languages
    environment, and even do development on the tool

-------------------------------------------------

-> What about GUI Apps? <-
==========================

Ok let's kick it up.

So far we've only been working with simple binaries on the
command line but docker is capable of much, much more. How
about GUI aplications? 

* Note: This is for linux only, sorry mac/windows
* ref: https://blog.jessfraz.com/post/
*      docker-containers-on-the-desktop/

-------------------------------------------------

-> Let's dockerize Spotify <-
=============================

example5.sh demo

- Explain how display can be shared with volumes
- Run spotify

-------------------------------------------------

-> Managing Multiple Containers? <-
===================================

Docker compose is a tool for defining multi container
environments that allow us to create a repeatable
infrastructure setup so that we can build complex
environments that have complex requirements.