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

31

Transcript of Docker 101 101 Russ Taylor Containers vs. VMs What are these ‘container’ things? Less Overhead ...

Docker 101Russ Taylor

Containers vs. VMs

What are these ‘container’ things?

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

Less Overhead

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

Isolated(Mostly)

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

No Dedicated Resources

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

No Resource Limits

Containers: A History

2000:

2001:

2004:(Containers)

2005:

2006: Process Containers ➡ cgroups

2008:

2013: lmctfy(let me contain that for you)

2013:

Why Containers?

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 ➡

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

Usually Ephemeral

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

Mostly Immutable

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

Portable

Hold Code, Not Data

Running Docker

LinuxWindows*

MacOS*

*Really, mostly for development.

Docker Registry

https://hub.docker.com/

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"]

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

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)

Thanks!

[email protected]