Introduction To Docker, Docker Compose, Docker Swarm
This document provides an introduction to Docker, Docker Compose, and Docker Swarm. It begins with an agenda and questions to gauge audience familiarity. It then defines Docker as a container engine that packages applications and dependencies into standardized units. Key differences between containers and virtual machines are outlined. Docker Compose is introduced as a tool to define and run multi-container applications with YAML files. Docker Swarm is a clustering tool that allows managing Docker nodes as a single virtual system for scaling and updating applications. The document demonstrates several Docker concepts and commands.
6 What is Docker?(cont.) Docker is an open platform for developing, shipping, and running applications. Docker allows you to package an application with all of its dependencies into a standardized unit for software development.
7.
7 What is Docker?(cont.) Standardized packaging for software and dependencies Isolate apps from each other Share the same OS kernel Works for all major Linux distributions Containers native to Windows Server 2016
10 Benefits of Docker Fast (deployment, migration, restarts) Secure Lightweight (save disk & CPU) Open Source Portable software Micro-services and integrations (APIs) Simplify DevOps Version control capabilities
11.
11 Technologies behind Docker Linux x86-64 Go language Client - Server (deamon) architecture Union file systems (UnionFS: AUFS, btrfs, vfs etc) Namespaces (pid, net, ipc, mnt, uts) Control Groups (cgroups) Container format (libcontainer)
13 Docker Vocabulary Dockerclient ● Is the primary user interface to Docker. ● Accepts commands from the user and communicates back and forth with a Docker daemon Docker daemon ● Runs on a host machine. ● Users do not directly interact with the daemon, but instead through the Docker client with the RESTful API or sockets
14.
14 Docker Vocabulary (cont.) Image ● Is a read-only template with instructions for creating a Docker container. ● An image is based on another image, with some additional customization Container ● Is a runnable instance of an image. ● A container is removed, any changes to its state that are not stored in persistent storage disappear
15.
15 Docker Vocabulary (cont.) Registry ● A Docker registry stores Docker images. ● Docker Hub and Docker Cloud are public registries that anyone can use ● You can run your own private registry
16.
16 Docker Vocabulary (cont.) Dockerfile ● Is a text document that contains all the commands a user could call on the command line to create an image ● Dockerfile reference on docker docs
17.
17 Docker Vocabulary (cont.) Volume ● Is a mount point on the container’s directory tree where a portion of the host directory tree has been mounted
22 Real life applications One application consists of multiple containers. One container is dependent on another. Mutual dependency/ startup order. Process involves building containers and then deploy them Long docker run commands Complexity is proportional to the number of containers involved
23.
23 What is Dockercompose? Tool for defining and running multi-container Docker application. It is a YML file. Compose contains information about how to build the containers and deploy containers. Integrated with Docker Swarm
26 What is Dockerswarm? Is a clustering and scheduling tool for Docker containers. With Swarm, IT administrators and developers can establish and manage a cluster of Docker nodes as a single virtual system A swarm is a group of machines that are running Docker and joined into a cluster
28 Feature highlights Clustermanagement integrated with Docker Engine ● Use the Docker Engine CLI to create a swarm of Docker Engines where you can deploy application services Declarative service model ● Uses a declarative approach to let you define the desired state of the various services in your application stack Scaling ● When you scale up or down, the swarm manager automatically adapts by adding or removing tasks to maintain the desired state
29.
29 Feature highlights (cont.) Desired state reconciliation ● Swarm manager node constantly monitors the cluster state and reconciles any differences between the actual state and your expressed desired state Service discovery ● Swarm manager nodes assign each service in the swarm a unique DNS name and load balances running containers Rolling updates ● At rollout time you can apply service updates to nodes incrementally. If anything goes wrong, you can roll-back a task to a previous version of the service
31 Core concepts Service: ●Services are really just “containers in production” ● A service only runs one image, but it codifies the way that image runs—what ports it should use, how many replicas of the container should run so the service has the capacity it needs, and so on ● Scaling a service changes the number of container instances running that piece of software
32.
32 Core concepts (cont.) Twotype of service: Replicated ● Specify the number of identical tasks you want Global ● Service that runs one task on every node
33.
33 Core concepts (cont.) Stack: ● A stack is a group of interrelated services that share dependencies, and can be orchestrated and scaled together ● A single stack is capable of defining and coordinating the functionality of an entire application (though very complex applications may want to use multiple stacks)