Docker and Containers for Development and Deployment - Comment
Docker is an Open Source engine to build, run, and manage containers. We'll explain what are Linux Containers, what powers them (under the hood), and what extra value Docker brings to the table. Then we'll see what the typical Docker workflow looks like from a developer point of view. We'll also give an Ops perspective, including deployment options. If you already saw a "Docker 101", consider this presentation as the February 2014 update! :-) Topics covered: 1. Best practices in development and deployment, with Docker and Containers February 2014—Docker 0.8.1 2. @jpetazzo ● Wrote dotCloud PAAS deployment tools –EC2, ● LXC, Puppet, Python, Shell, ØMQ... Docker contributor –Docker-in-Docker, VPN-in-Docker, router-in-Docker... CONTAINERIZE ALL THE THINGS! ● Runs Docker in production –You shouldn't do it, but here's how anyway! 3. Outline ● Why should I care? ● The container metaphor ● Very quick demo ● Working with Docker ● Building images ● Docker future 4. Outline ● Why should I care? ● The container metaphor ● Very quick demo ● Working with Docker ● Building images ● Docker future 5. Deploy everything ● webapps ● backends ● SQL, NoSQL ● big data ● message queues ● … and more 6. Deploy almost everywhere 7. Deploy almost everywhere YUP 8. Deploy almost everywhere YUP SOON 9. Deploy almost everywhere YUP SOON SOON 10. Deploy almost everywhere YUP SOON SOON 11. Deploy almost everywhere YUP SOON SOON CLI 12. Deploy almost everywhere YUP SOON SOON CLI 13. Deploy almost everywhere YUP SOON SOON CLI Yeah, right... 14. Deploy almost everywhere YUP SOON SOON CLI 15. Deploy almost everywhere ● Linux servers ● VMs or bare metal ● Any distro ● Kernel 3.8 (or RHEL 2.6.32) 16. Deploy reliably & consistently 17. Deploy reliably & consistently ● If it works locally, it will work on the server ● With exactly the same behavior ● Regardless of versions ● Regardless of distros ● Regardless of dependencies 18. Deploy efficiently ● Containers are lightweight – – ● Typical laptop runs 10-100 containers easily Typical server can run 100-1000 containers Containers can run at native speeds – Lies, damn lies, and other benchmarks: http://qiita.com/syoyo/items/bea48de8d7c6d8c73435 19. The performance! It's over 9000! 20. Outline ● Why should I care? ● The container metaphor ● Very quick demo ● Working with Docker ● Building images ● Docker future 21. … Container ? 22. High level approach: it's a lightweight VM ● own process space ● own network interface ● can run stuff as root ● can have its own /sbin/init (different from the host) « Machine Container » 23. Low level approach: it's chroot on steroids ● can also not have its own /sbin/init ● container = isolated process(es) ● share kernel with host ● no device emulation (neither HVM nor PV) « Application Container » 24. How does it work? Isolation with namespaces ● pid ● mnt ● net ● uts ● ipc ● user 25. pid namespace jpetazzo@tarrasque:~$ ps aux | wc -l 212 jpetazzo@tarrasque:~$ sudo docker run -t -i ubuntu bash root@ea319b8ac416:/# ps aux USER root root PID %CPU %MEM 1 0.0 0.0 16 0.0 0.0 (That's 2 processes) VSZ 18044 15276 RSS TTY 1956 ? 1136 ? STAT START S 02:54 R+ 02:55 TIME COMMAND 0:00 bash 0:00 ps aux 26. mnt namespace jpetazzo@tarrasque:~$ wc -l /proc/mounts 32 /proc/mounts root@ea319b8ac416:/# wc -l /proc/mounts 10 /proc/mounts 27. net namespace root@ea319b8ac416:/# ip addr 1: lo: mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 22: eth0: pfifo_fast state UP qlen 1000 mtu 1500 qdisc link/ether 2a:d1:4b:7e:bf:b5 brd ff:ff:ff:ff:ff:ff inet 10.1.1.3/24 brd 10.1.1.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::28d1:4bff:fe7e:bfb5/64 scope link valid_lft forever preferred_lft forever 28. uts namespace jpetazzo@tarrasque:~$ hostname tarrasque root@ea319b8ac416:/# hostname ea319b8ac416 29. ipc namespace jpetazzo@tarrasque:~$ ipcs ------ Shared Memory Segments -------key shmid owner perms 0x00000000 3178496 jpetazzo 600 0x00000000 557057 jpetazzo 777 0x00000000 3211266 jpetazzo 600 root@ea319b8ac416:/# ipcs ------ Shared Memory Segments -------key shmid owner perms ------ Semaphore Arrays -------key semid owner perms ------ Message Queues -------key msqid owner perms bytes 393216 2778672 393216 nattch 2 0 2 status dest bytes nattch status nsems used-bytes messages dest 30. user namespace ● ● ● No demo, but see LXC 1.0 (just released) UID 0→1999 in container C1 is mapped to UID 10000→11999 in host; UID 0→1999 in container C2 is mapped to UID 12000→13999 in host; etc. what will happen with copy-on-write? – double translation at VFS? – single root UID on read-only FS? 31. How does it work? Isolation with cgroups ● memory ● cpu ● blkio ● devices 32. memory cgroup ● keeps track pages used by each group: – file (read/write/mmap from block devices; swap) – anonymous (stack, heap, anonymous mmap) – active (recently accessed) – inactive (candidate for eviction) ● each page is « charged » to a group ● pages can be shared (e.g. if you use any COW FS) ● Individual (per-cgroup) limits and out-of-memory killer 33. cpu and cpuset cgroups ● keep track of user/system CPU time ● set relative weight per group ● pin groups to specific CPU(s) – Can be used to « reserve » CPUs for some apps – This is also relevant for big NUMA systems 34. blkio cgroups ● keep track IOs for each block device – read vs write; sync vs async ● set relative weights ● set throttle (limits) for each block device – read vs write; bytes/sec vs operations/sec Note: earlier versions ( /usr/local/etc/couchdb/local.d/docker.ini EXPOSE 8101 CMD ["/usr/local/bin/couchdb"] docker build -t jpetazzo/couchdb . 68. Authoring images with a Dockerfile ● Minimal learning curve ● Rebuilds are easy ● Caching system makes rebuilds faster ● Single file to define the whole environment! 69. Do you even Chef? Puppet? Ansible? Salt? 70. Docker and Puppet 71. Docker and Puppet ● Get a Delorean ● Warm up flux capacitors ● Time-travel to yesterday ● Check Brandon Burton's lightning talk ● Check my talk — Or — ● Get the slides, ask questions ☺ 72. Outline ● Why should I care? ● The container metaphor ● Very quick demo ● Working with Docker ● Building images ● Docker future 73. Coming Soon ● Network acceleration ● Container-specific metrics ● Consolidated logging ● Plugins (compute backends...) ● Orchestration hooks Those things are already possible, but will soon be part of the core. 74. Docker 1.0 ● Multi-arch, multi-OS ● Stable control API ● Stable plugin API ● Resiliency ● Signature ● Clustering 75. Recap Docker: ● Is easy to install ● Will run anything, anywhere ● Gives you repeatable builds ● Enables better CI/CD workflows ● Is backed by a strong community ● Will change how we build and ship software 76. Thank you! Questions? http://docker.io/ http://docker.com/ @docker @jpetazzo |
|||
Posted by : peter88 | Post date : 2020-01-06 16:20 | ||
Category : Technology | Views : 455 | ||
New Comment