%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 ------------------------------------------------- -> 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 There will be no demo of a VM time equivalent ------------------------------------------------- If the time difference between running a program on the machine and running a program in a container is negligible, then why don't we start running all commands inside of containers? ------------------------------------------------- Answer: We don't understand Docker yet. But after this we will! ------------------------------------------------- -> Let's dockerize a command <- =============================== example2.sh demo ------------------------------------------------- As you can see the run time of the program inside the container is blazingly fast. We can extend this concept of dockerizing command by building our own docker images that install all the dependancies necessary. ------------------------------------------------- -> Introducting Docker Files <- =============================== Dockerfiles are a set of instructions that build a docker image which can then be ran locally, shared with others, and even extended to be included in other docker files.