Slide 1

Slide 1 text

1 Docker Learnings TEC Lunch & Learn, 2016-01-06 Danilo Bargen

Slide 2

Slide 2 text

2 Agenda 1. What is Docker? 2. Why the hype? 3. Docker Security 4. Conclusions 5. Questions

Slide 3

Slide 3 text

3 1. What is Docker?

Slide 4

Slide 4 text

4 «Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in.» www.docker.com

Slide 5

Slide 5 text

5 Layer Filesystem - Uses union file system - Multiple layers are unified into a single file system - Only the top layer is writeable

Slide 6

Slide 6 text

6 Lightweight - Shared kernel - Instant start (in the range of milliseconds) - Layers make disk usage and image downloads more efficient

Slide 7

Slide 7 text

7 Kind-of-secure - Containers provide isolation - Not battle-tested yet though - More about this later

Slide 8

Slide 8 text

8 Containers vs VMs - VMs contain the guest OS, containers don’t - VMs try to emulate hardware, containers don’t - Makes them faster, smaller, more portable

Slide 9

Slide 9 text

9 Terminology - An image is a stack of filesystem layers that can be used to launch a container. This is like a class in OOP. - A container is an image instance. This is like an instance in OOP. A container can be started or stopped. - Both images and containers can be tagged. - A docker server runs the containers. - A docker client talks to the server to control containers. - A docker registry can be used to upload and download images. Publically available registries include the DockerHub and Quay. io.

Slide 10

Slide 10 text

10 Technologies - Linux namespaces for isolation - Linux cgroups for resource management - Union file systems: AUFS, btrfs, vfs, DeviceMapper - Container format: LXC, libcontainer

Slide 11

Slide 11 text

11 Possible Uses - Isolate multiple services on the same server from each other - Keep code and configuration together - Accelerate developer onboarding - Eliminate environment inconsistencies

Slide 12

Slide 12 text

12 2. Why the hype?

Slide 13

Slide 13 text

13 Containers aren’t anything new - FreeBSD Jails - Google containers - OpenVZ - LXC

Slide 14

Slide 14 text

14 Then why the hype? - Easy to get started - Nice docs - Great name & cute logo - Rise of cloud computing - Developed by a startup, not by a big enterprise company - Dockerhub - Great adoption, so a lot of hosting options

Slide 15

Slide 15 text

15 3. Docker Security

Slide 16

Slide 16 text

16 Things To Note - Members of the docker group == root users - Don’t run your containers as root users! - Docker is safe in theory, but still young technology and not battle tested - Isolation through cgroups and namespaces. Shared kernel means that kernel exploits lead to bad consequences. - You should make yourself familiar with how namespaces and cgroups work.

Slide 17

Slide 17 text

17 Watch this https://youtu.be/_lExqHukqOw

Slide 18

Slide 18 text

18 4. Conclusion

Slide 19

Slide 19 text

19 Learnings I - Code and Dockerfile belong together - Good for immutable applications - Good for simple deployments - Might be good for testing & integration - Might be good for development

Slide 20

Slide 20 text

20 Learnings II - Right now configuration/secrets can be done through env variables. In the future through something like Vault. - Jenkins can build images after every successful test. - Jenkins can regularly rebuild images to include security updates in base layers. - We should regularly run the deployment script on moby to pull new images. - Read the docker book!

Slide 21

Slide 21 text

21 Resources - “Getting Started” in Docker docs https://docs.docker.com/ - “The Docker Book” http://books.linuxfocus. net/books/view/652 - “Docker: Up & Running” by O’Reilly http://shop.oreilly.com/product/0636920036142.do

Slide 22

Slide 22 text

22 5. Questions?