3

My understanding of Linux Containers (LXC) is that it provides a native hypervisor for Linux systems, similar to Windows' Hyper-V introduced in Windows 8. By "native hypervisor", I mean, the ability for the Linux system to host guest VMs inside of it without having to install any kind of specialized virtualization software.

My understanding of Docker is that it somehow builds on top of LXC, and allows application developers to define:

  1. The exact app stack of a VM/node, including the OS, the exact configuration and tuning of the OS, and any tools or applications installed/configured/deployed to that OS; and
  2. The exact resource requirements for running this VM/node, including CPU requirements, memory/disk/network requirements, load balancing and replication requirements, etc. Docker then figures out what nodes to run the container on, using these declared requirements as its baseline.

So first off, if my understanding of LXC or Docker is mislead at all, please begin by correcting me!

Assuming I'm more or less correct in my understanding, I ask:

  • What is the relationship between Docker and, say, vmWare or Xen VMs? Does Docker "sit on top" of the virtualization layer? In other words, are there "Docker bindings" for different virtualization platforms (vmWare, Xen, kvm, etc.), and I could take a Docker container for myapp and deploy it to any Docker-ified platform?
  • What is the relationship between LXC and Docker? Does Docker simply just extend LXC, or is it a similar (but completely separate) concept altogether? If its an extension of LXC, then in what way?
smeeb
  • 27,777
  • 57
  • 250
  • 447

1 Answers1

2

relationship between LXC and Docker, -> docker started using LXC, but since docker 0.9, docker uses libcontainer, and no longer uses lxc-start to start the containers. Compared to LXC, docker offers a REST Api, allows to move images from and to the registry, allows to build using Dockerfiles...

Brad Solomon
  • 38,521
  • 31
  • 149
  • 235
user2915097
  • 30,758
  • 6
  • 57
  • 59
  • Thanks @user2915097 (+1) - but what about my first question (Docker's relationship to virtualization platforms, such as vmWare or Xen)? Also, for the question you answered, can you elaborate on what a Docker "registry" is? I'm also confused about the relationship between `libcontainer` and `lxc-start` - are these competing libraries? Thanks again! – smeeb Jan 19 '15 at 12:45
  • 2
    docker has no relationship to VMWare or Xen, it is a different concept, you have the bare minimum to run a process, file system isolation (each container has its own root filesystem), process isolation, network isolation (separate virtual interface and IP address), resource isolation, specific logging (STDIN, STDOUT and STDERR are available), – user2915097 Jan 19 '15 at 12:51
  • 1
    Also a container has a default of 10 GB of disk space, that can be modfied, see http://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/, and `docker run` allows you to specify a share of CPU and memory allocated to the container, see https://docs.docker.com/reference/run/#runtime-constraints-on-cpu-and-memory and this excellent post https://goldmann.pl/blog/2014/09/11/resource-management-in-docker/ – user2915097 Jan 19 '15 at 12:57
  • 1
    Also have a look at this benchmark comparing docker and KVM, from a guy at IBM, http://bodenr.blogspot.fr/2014/05/kvm-and-docker-lxc-benchmarking-with.html – user2915097 Jan 19 '15 at 13:06
  • Thanks again @user2915097 (+3 for all) - so is Docker something that I'd install on an *existing* VM/node (we use vSphere), or does it somehow *integrate* with, say, vSphere, and then abstract our need to worry about specific VMs? – smeeb Jan 19 '15 at 13:08
  • Docker is (at the moment) a project relying on Linux specific (cgroups, namespaces...), so if you are on a Linux, you just `sudo apt-get install docker.io` and if you are on a Windows, you have boot2docker, that installs a Virtualbox, so that you can have Linux VM. Microsoft have announced that a future version of Windows will integrate docker, see http://azure.microsoft.com/blog/2014/10/15/new-windows-server-containers-and-azure-support-for-docker/ and Microsoft has recently announced a docker cli for Windows http://azure.microsoft.com/blog/2014/11/18/docker-cli-for-windows-clients/ – user2915097 Jan 19 '15 at 13:13
  • You asked about docker registry, if you go to https://registry.hub.docker.com/ you will see a lot of dockerized applications, like a web server (nginx) , a database (Redis, MongoDB, PostgreSQL...). This is the "official" registry, but you can launch your own, see this post https://www.digitalocean.com/community/tutorials/how-to-set-up-a-private-docker-registry-on-ubuntu-14-04 – user2915097 Jan 19 '15 at 13:16
  • Docker, to the best of my knowledge, does not integrate with Vsphere, but you can absolutely install it on a VM, with no or very little performance degradation see this post http://blogs.vmware.com/performance/2014/10/docker-containers-performance-vmware-vsphere.html, and notice the very small difference of native docker and VM-docker – user2915097 Jan 19 '15 at 13:30
  • You should install docker on a Linux node, and "play" a little with it, launch a Nginx web server for example, with a basic `docker pull nginx` , have a look at the associated Dockerfile https://github.com/nginxinc/docker-nginx/blob/57da11369acbec3256b0c2704a50282eeabb684f/Dockerfile, connect to the webserver on the ports 80 and 443, modify the Dockerfile, build it again... – user2915097 Jan 19 '15 at 13:41
  • docker is just an easy way to isolate a process, I have read an interview of a guy from docker.io, where he explains "in 2008, it was possible to do the same as what we do today with docker, but it required a skilled and motivated system manager". Nothing really new, docker has just simplified and automated a lot the whole process. – user2915097 Jan 19 '15 at 15:18