Containers

Updated: 2018-12-15

Most notably: Docker + Kubernetes

Container

Orchestration:

https://www.slideshare.net/Docker/aravindnarayanan-facebook140613153626phpapp02-37588997

Containers:

  • Docker: an open source Linux containerization technology. Package, distribute and runtime solution.
  • cgroup: limits and isolates resources(CPU, memory, disk I/O, network, etc)
  • lxc(linuxcontainer)
  • CoreOS
  • containerd: Container Runtime
  • rkt: Container Runtime
  • gVisor: a user-space kernel for containers. It limits the host kernel surface accessible to the application while still giving the application access to all the features it expects. It leverages existing host kernel functionality and runs as a normal user-space process

Orchestration:

  • Kuberenetes
  • Swarm
  • Mesos
  • Nomad

Packaging Before Docker

Package Operating Systems as images to run with Virtual Machine software:

  • .iso — Raw disk images
  • .vdmk — VMWare Disk Images
  • .box — Vagrant Boxes
  • .ovf — Open Virtualization Format
  • AMI — Amazon Machine Images

Package applications as archives:

  • .zip and.tgz — Who knows? Source distribution or platform specific binary distribution
  • .deb — Debian packages
  • .rpm — Redhat Packages
  • Shell/Perl/Ruby scripts — Homebrew, Makefile, and bespoke distribution

APIs

  • 2 most important APIs: Images and Container APIs

Readings

Swarm

  • Manager quorum: Raft: exchange information with strong consistency
  • Worker: Gossip: share information in bulk, converge fast
  • Between manager and worker: GRPC(on top of HTTP/2, versioned)

Docker for Mac

The Docker for Mac application does not use docker-machine to provision that VM; but rather creates and manages it directly.

No more VirtualBox!

Docker Compose, Docker Machine, Docker Engine

Compose is a tool for defining and running multi-container Docker applications.

Docker Machine is a tool for provisioning and managing your Dockerized hosts (hosts with Docker Engine on them). Typically, you install Docker Machine on your local system. Docker Machine has its own command line client docker-machine and the Docker Engine client, docker

Docker Engine, the client-server application made up of the Docker daemon, a REST API that specifies interfaces for interacting with the daemon, and a command line interface (CLI) client that talks to the daemon (through the REST API wrapper). Docker Engine accepts docker commands from the CLI, such as docker run <image>,docker ps to list running containers, docker images to list images, and so on.

Unlike traditional virtualization, containerization takes place at the kernel level. Most modern operating system kernels now support the primitives necessary for containerization, including Linux with openvz, vserver and more recently lxc, Solaris with zones, and FreeBSD with Jails.

Because Docker operates at the OS level, it can still be run inside a VM!

CMD vs ENTRYPOINT

Both CMD and ENTRYPOINT instructions define what command gets executed when running a container. There are few rules that describe their co-operation.

Dockerfile should specify at least one of CMD or ENTRYPOINT commands. ENTRYPOINT should be defined when using the container as an executable. CMD should be used as a way of defining default arguments for an ENTRYPOINT command or for executing an ad-hoc command in a container. CMD will be overridden when running the container with alternative arguments.