Skip to content

Docker and Containers: The Big Picture

Kota edited this page Oct 12, 2018 · 13 revisions
  • vmware: multiple apps running safely on the same server

    • VM / Hypervisor: Slices physical CPU/RAMDisk into virtual machines. Each runs on its own OS
    • Hypervisors virtualization model: a single physical server (processors, memory, diskspace) will be sliced into multiple VMs
      • 4 vms on a single server configured to take 25% of the physical server's processors, memory, disk space
      • Each vm need it's own OS (Windows,linux etc..): uses CPU, RAM, disk space and also requires a license
  • Containers: Several containers are created on the physical server which are shared by single OS

    • Conatiners: Slice OS resources - process namespace, network stack, storage stack, file root system etc..
    • More apps on the same physical server compared to vm(s)
    • Docker: Earlier dotCloud. From 2013, a open source containerization tool.
    • Authentication: DCT - Docker Content Trust

Docker Containers

  • Cloud
    • Build: engine, Swarm etc..
    • Ship: Dockerhub, Quay.io, Like an app store for Docker Images
    • Run: Tutum etc
  • On Premises
    • Build: engine, Swarm etc..
    • Ship: Docker Trusted Registry (DTR)
    • Run: Docker Universal Control Panel

Container Orchestration

  • Docker Machine: Provisions Docker hosts/engines
  • Docker Compose: Compose multi-container apps
  • Docker Swarm: Schedule containers over multiple docker engines
  • Docker Tutum: UI to control and manage everything
  • More: Kubernetes, Mesosphere DCOS, (CoreOS fleet, etcd..), OpenStack Magnum..

Installation

  • Docker for Linux, Mac
  • Docker for Windows: Runs Docker on Linux Hyper VM (MobyLinuxVM). This doesn't stops running cmd/powershell and execute docker commands. Native Docker for windows is coming soon.
    • Hyper-V feature installed (Turn Windows feature on or off)
    • Download docker for windows from www.docker.com & Install. That's Done !! (cmd> docker version)
    • HyperV Manager helps you know whats going on behind the scenes
    • Installation is different for Windows Server 2016

Commands

  • Basic
    • docker run hello-world starts a new "hello-world" container (Docker Daemon searches for hello-world containers locally if not found searches in hub.docker.com)
    • docker run -d <image> Runs the Container in detached mode
    • docker ps lists active containers running
    • docker ps -a lists containers which ran and exited
    • docker info high level information
    • docker images lists all images that are created locally (~ Images are stopped containers. Containers are running Images)
    • Run commands call "Docker Client" which calls "Docker Daemon" through APIs
    • Examples: docker pull alpine, docker pull ubuntu:14.04 (pulls images and stores locally)
    • docker rmi ubuntu:14.04 deletes images from local
    • Start a Container: docker start <container>, Stop a Container: dockr stop <container>

Swarm Mode

  • Collection of several Docker Engines = Clustering = Swarm
  • A manager node maintain the swarm
  • Worker nodes accept tasks from manager nodes and executes it
  • Services: A declarative way of running and scaling tasks.
    • If any one goes down it will boot up a new one.
  • Tasks: A unit of work assigned to workers. ~ Containers
  • Stacks & Bundles: to ensure that the above works with multiple services
  • Basic Commands
    • Creating a Swarm: docker swarm init ... on the first manager (on any node)
    • Joining the Swarm: docker swarm join ... on the rest of the nodes
    • Creating a Service: docker service create ... <with_replicas> runs a service and assigned to all the nodes so that the swarm can balance the load
    • docker service scale ... Increasing the no of services (in parallel)
    • docker service update ... Updating the service (to newer versions ?)

Links

Clone this wiki locally