14
Docker Compose and Docker Swarm By Tanmay Mehra

Docker compose and swarm

Embed Size (px)

Citation preview

Page 1: Docker compose and swarm

Docker Compose and Docker Swarm By Tanmay Mehra

Page 2: Docker compose and swarm

What is Docker ? Docker is an open platform for developing, shipping, and running applications.

Docker provides a way to run almost any application securely isolated in a container.

The isolation and security allow you to run many containers simultaneously on your host.

The lightweight nature of containers, which run without the extra load of a hypervisor, means you can get more out of your hardware.

Page 3: Docker compose and swarm

Docker Components

Docker: the open source container virtualization platform

Docker Hub: SaaS platform for sharing and managing Docker images

Docker Daemon runs on a host machine and does the heavy lifting of building, running, and distributing Docker containers.

Docker client is a Docker binary that accepts commands from the user and communicates back and forth with daemon.

Page 4: Docker compose and swarm

How does it work ?

Page 5: Docker compose and swarm

Docker Demo

Create docker-machine

Pull an image

Create a Container

Start a container

Stop and Remove a container

Page 6: Docker compose and swarm

Docker Compose

Compose is a tool for defining and running complex applications with Docker.

With Compose, you define a multi-container application in a single file, then spin your application up in a single command which does everything that needs to be done to get it running.

Compose is great for development, testing, and staging environments, as well as CI workflows.

Page 7: Docker compose and swarm

How to use Docker Compose ?

Define your app’s environment with a Dockerfile so it can be reproduced anywhere.

Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment.

Lastly, run docker-compose up and Compose will start and run your entire app.

Page 8: Docker compose and swarm

Docker Compose

Page 9: Docker compose and swarm

Docker Compose Demo

Install docker compose

Create a compose file docker-compose.yml

docker-compose up

check containers created

check server up

Page 10: Docker compose and swarm

Docker Swarm

Docker Swarm provides native clustering to Docker.

It turns a pool of Docker hosts into a single, virtual Docker host.

Docker Swarm solves one of the fundamental limitations of Docker where the containers could only run on a single Docker host.

Page 11: Docker compose and swarm

Docker Swarm Components

like consul, zookeeper and etcd.

Page 12: Docker compose and swarm

Swarm Scheduling Strategies

The Docker Swarm scheduler features multiple strategies for ranking nodes. The strategy you choose determines how Swarm computes ranking.

spread: Swarm optimizes for the node with the least number of running containers

binpack: The binpack strategy causes Swarm to optimize for the node which is most packed.

random: The random strategy, like it sounds, chooses nodes at random regardless of their available CPU or RAM.

Page 13: Docker compose and swarm

Docker SwarmDemo

Create Swarm manager

Create Swarm nodes

Join swarm nodes with Swarm manager

Create containers using swarm manager

Run the application

Page 14: Docker compose and swarm

Thank You !!