Top Banner
31

Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things? Less Overhead Isolated (Mostly) ...

Mar 31, 2018

Download

Documents

dangcong
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...
Page 2: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

Docker 101Russ Taylor

Page 3: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

Containers vs. VMs

What are these ‘container’ things?

Page 4: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...
Page 5: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

https://www.flickr.com/photos/jaxport/

Less Overhead

Page 6: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

https://www.flickr.com/photos/whatmeworry/

Isolated(Mostly)

Page 7: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

https://www.flickr.com/photos/143903271@N02/

No Dedicated Resources

Page 8: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

https://www.flickr.com/photos/dahlstroms/

No Resource Limits

Page 9: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

Containers: A History

Page 10: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

2000:

Page 11: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

2001:

Page 12: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

2004:(Containers)

Page 13: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

2005:

Page 14: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

2006: Process Containers ➡ cgroups

Page 15: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

2008:

Page 16: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

2013: lmctfy(let me contain that for you)

Page 17: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

2013:

Page 18: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

Why Containers?

Page 19: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

Super Minimal

root@00fcf1ae4e67:/# ps -A PID TTY TIME CMD 1 ? 00:00:00 bash 11 ? 00:00:00 ps

802 ? 00:00:00 xfsalloc 803 ? 00:00:00 xfs_mru_cache 805 ? 00:00:00 glock_workqueue 806 ? 00:00:00 delete_workqueu 811 ? 00:00:00 gfs_recovery 908 ? 00:00:00 acpi_thermal_pm 1565 ? 00:00:00 bioset 1566 ? 00:00:00 drbd-reissue 1567 ? 00:00:00 rbd 1569 ? 00:00:00 scsi_eh_0 1570 ? 00:00:00 scsi_tmf_0 1573 ? 00:00:00 bioset 1580 ? 00:00:00 bioset 1839 ? 00:00:00 scsi_eh_1 1844 ? 00:00:00 kworker/u2:3 1854 ? 00:00:00 scsi_tmf_1 1855 ? 00:00:00 scsi_eh_2 1857 ? 00:00:00 kworker/u2:4 1860 ? 00:00:00 scsi_tmf_2 1863 ? 00:00:00 kworker/u2:5 1878 ? 00:00:00 kworker/u2:6 1890 ? 00:00:00 raid5wq 1896 ? 00:00:00 dm_bufio_cache 1919 ? 00:00:00 ipv6_addrconf 1933 ? 00:00:00 kworker/0:2 1936 ? 00:00:00 ceph-msgr 1959 ? 00:00:00 bioset 1976 ? 00:00:00 bioset 1983 ? 00:00:00 bioset 1987 ? 00:00:00 kworker/0:1H 1988 ? 00:00:00 jbd2/sda-8 1989 ? 00:00:00 ext4-rsv-conver 2009 ? 00:00:00 systemd-journal 2011 ? 00:00:00 kworker/0:3 2016 ? 00:00:00 kworker/0:4 2019 ? 00:00:00 kworker/0:5 2020 ? 00:00:00 kauditd 2023 ? 00:00:00 systemd-udevd 2029 ? 00:00:00 kworker/0:6 2159 ? 00:00:00 systemd-timesyn 3416 ? 00:00:00 rsyslogd 3418 ? 00:00:00 dbus-daemon 3423 ? 00:00:00 cron 3425 ? 00:00:00 accounts-daemon 3428 ? 00:00:00 systemd-logind 3471 ttyS0 00:00:00 agetty 3473 tty1 00:00:00 agetty 3475 ? 00:00:00 ondemand 3489 ? 00:00:00 sleep 3653 ? 00:00:00 sshd 3717 ? 00:00:00 sshd 3719 ? 00:00:00 systemd 3760 ? 00:00:00 (sd-pam)

VM ➡

Page 20: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

https://www.flickr.com/photos/onascht/

Usually Ephemeral

Page 21: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

https://www.flickr.com/photos/tristantaussac/

Mostly Immutable

Page 22: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

https://www.flickr.com/photos/soldiersmediacenter/

Portable

Page 23: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

Hold Code, Not Data

Page 24: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

Running Docker

Page 25: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

LinuxWindows*

MacOS*

*Really, mostly for development.

Page 27: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

Docker Registry

https://hub.docker.com/

Page 28: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

Dockerfiles# From any image & tag (default tag is 'latest')FROM node:7.8.0

MAINTAINER Bend Hackers <[email protected]>

# Set environment variablesENV APP_PATH /var/app

# Copy folders/files into the imageCOPY src $APP_PATH

# Set the work directoryWORKDIR $APP_PATH

# Run arbitrary commandsRUN npm install

# Run when the container startsCMD ["node", "app.js"]

Page 29: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

Demo Time!https://github.com/russtaylor/docker-101

Page 30: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

Resources

● https://docs.docker.com

● https://docs.docker.com/compose/

● https://docs.docker.com/engine/reference/commandline/docker/

● http://shop.oreilly.com/product/0636920035671.do (Using Docker, O’Reilly)

Page 31: Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things?  Less Overhead  Isolated (Mostly)  ...

Thanks!

[email protected]