Virtualization using Docker platform
Virtualization using Docker platform
/012345<yA|
M ASARYK U NIVERSITY
FACULTY OF I NFORMATICS
M ASTER ’ S T HESIS
Vladimír Jurenka
Vladimír Jurenka
ii
Acknowledgement
I would like to thank my supervisor RNDr. Filip Nguyen, for his
advices, encouragement and insightful feedback.
iii
Abstract
The aim of the diploma work is to provide an overview of virtu-
alization methods, while focusing on Docker. This new virtualiza-
tion platform, which greatly differs from the traditional, virtual ma-
chine based approach to virtualization, has sparked massive interest
in Linux containers. As a result, many Docker based projects have
emerged ranging from simple command line tools to entire operat-
ing systems. To gain a deeper understanding of Docker’s internal
mechanisms, the practical part of this thesis demonstrates working
with Docker’s Remote API and further enhances Docker with a new
command.
iv
Keywords
Docker, virtualization, virtual machines, containers, vmware, virtu-
albox, linuc, lxc, namespaces, cgroups
v
Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Virtualization . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1 Virtualization use cases . . . . . . . . . . . . . . . . . . . 2
2.2 Virtual machine based virtualization . . . . . . . . . . . 4
2.2.1 Virtual machine monitors . . . . . . . . . . . . . 4
2.2.2 Software based virtualization . . . . . . . . . . . 5
2.2.3 Hardware assisted virtualization . . . . . . . . . 7
2.2.4 VirtualBox . . . . . . . . . . . . . . . . . . . . . . 8
2.2.5 VMWare Player . . . . . . . . . . . . . . . . . . . 9
2.2.6 Other tools . . . . . . . . . . . . . . . . . . . . . . 10
2.3 Container based virtualization . . . . . . . . . . . . . . 11
2.3.1 Chroot and jail . . . . . . . . . . . . . . . . . . . 11
2.3.2 Namespaces . . . . . . . . . . . . . . . . . . . . . 12
2.3.3 Control groups . . . . . . . . . . . . . . . . . . . 14
2.3.4 Container based virtualization tools . . . . . . . 15
2.3.5 Comparison with virtual machines . . . . . . . . 17
3 Docker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.1 History of Docker . . . . . . . . . . . . . . . . . . . . . . 18
3.2 Docker daemon . . . . . . . . . . . . . . . . . . . . . . . 19
3.3 Libcontainer . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.4 Layering filesystem in Docker . . . . . . . . . . . . . . . 21
3.5 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.6 Performance . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.7 Future . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4 Using Docker . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.1 Installing Docker . . . . . . . . . . . . . . . . . . . . . . 31
4.2 Docker basics . . . . . . . . . . . . . . . . . . . . . . . . 33
4.3 Docker containers . . . . . . . . . . . . . . . . . . . . . . 36
4.4 Docker images . . . . . . . . . . . . . . . . . . . . . . . . 36
4.4.1 Docker registry . . . . . . . . . . . . . . . . . . . 37
4.4.2 Docker Hub . . . . . . . . . . . . . . . . . . . . . 38
4.5 Docker Orchestration Tools . . . . . . . . . . . . . . . . 39
4.5.1 Docker Swarm . . . . . . . . . . . . . . . . . . . 39
4.5.2 Docker Machine . . . . . . . . . . . . . . . . . . 40
4.5.3 Docker Compose . . . . . . . . . . . . . . . . . . 40
vi
4.6 Family of Docker APIs . . . . . . . . . . . . . . . . . . . 41
4.6.1 Docker Remote API . . . . . . . . . . . . . . . . 41
4.7 Docker vs other container technologies . . . . . . . . . 42
5 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.1 Using Docker Remote API . . . . . . . . . . . . . . . . . 43
5.2 Docker update . . . . . . . . . . . . . . . . . . . . . . . . 44
6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
7 Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
7.1 Attached files . . . . . . . . . . . . . . . . . . . . . . . . 49
vii
1 Introduction
"Virtualization refers to the creation of virtual machines which have
an independent Operating Systems but the execution of software
running on the virtual machine is separated from the underlying
hardware resources. Also it is possible that multiple virtual machines
can share the same underlying hardware."[1] It has been around for
many years, throughout which the range of offered features widened
and its performance gradually increased. However, there is still some
space for improvement and one particular project - Docker is trying
exactly that. This thesis therefore takes a look at the core virtualiza-
tion technologies and tools and compares them to Docker, which is
also described in detail along with other tools built on top of it.
The first chapter starts with the presentation of the most frequent
use cases for virtualization and later explains the two major approaches
to it. Next, the focus shifts to the analysis of virtual machine based
virtualization techniques and tools. A more lightweight method of
creating an isolated environment, container based virtualization, is
described afterwards, presenting both its benefits and shortcomings
as well as several available tools.
The third chapter introduces Docker, the new popular virtualiza-
tion platform and describes its history and inner structures, while
taking a look at its security and performance. Furthermore an overview
of several large Docker-based virtualization projects is provided. As
to how to use Docker, the following chapter explains its core princi-
ples, high-level tools and ends with a comparison to the other con-
tainer based virtualization tools.
Finally, in the implementation part, Docker Remote API is used
to exchange a file between two running containers. This simple test
of Docker-java library serves as an example of interoperability of
Docker with custom programs or scripts. Last but not least, Docket
itself is modified and extended with a new command - docker up-
date.
1
2 Virtualization
2
2. V IRTUALIZATION
3
2. V IRTUALIZATION
4
2. V IRTUALIZATION
CPU
Modern CPUs utilise a resource protection scheme where several
privilege rings are created and each of them represents a different
level of trust. An x86 architecture offers up to four rings (numbered 0
to 3) and usually a lower ring number represents more trusted code.
Sometimes, the ring numbers are referred to as current privilege level
- CPL. The operating system’s part, which needs the most privileges
runs in ring 0, device drivers run in ring 1 or more and for most other
applications, the highest ring number is enough. Some instructions,
for example direct I/O require the highest privileges. When a user
application needs such instructions, it calls a function provided by
the operating system, which triggers execution of operating system’s
5
2. V IRTUALIZATION
kernel code, running in ring 0. Once the function completes, the func-
tion returns the appropriate result and the execution of the applica-
tion’s code continues, with privileges falling back. Such mechanism
is called a system call, the lower privileged layer(ring), where appli-
cations run marks the user space, and the kernel’s layer is labelled as
kernelspace.
From the virtualization perspective, this provides a security mech-
anism, which helps to satisfy the virtual machines monitor’s security
property. By not running the guest code in ring 0, the host operating
system is the only one with full control of the computer’s resources.
However, when the guest operating tries to execute a system a call, it
would fail, since it doesn’t run in ring 0. To overcome this issue, one
can employ paravirtualization, a compile-time technique, in which
the instructions that are impossible to execute in virtualized environ-
ment are replaced statically. Furthermore, additional drivers may be
installed, which allow the host to communicate with the hypervisor.
Another option is to replace the instructions at runtime, by scanning
the executing code and patching it where necessary.
Memory
Modern processors use a concept of virtual memory, where every ap-
plication gets the illusion, that it can use the entire system memory
for itself. In order for this technique to work, the operating system
has to manage the mapping of virtual memory to physical memory. If
the total memory consumed by applications is larger than the phys-
ical memory, parts of the virtual memory are temporary moved to a
secondary storage (disc).
Since the guest operating system doesn’t know that the host is
already managing the virtual memory, this introduces a heavy per-
formance penalty for virtual machines, because every memory ac-
cess from the guest has to be mapped firstly in the guest’s address
space and then again in the host’s address space. The solution is to
shadow the page table, (the structure which keeps track of memory
mappings), where every time the guest maps a memory, the hypervi-
sor performs a direct mapping to host’s memory in the shadow table.
Then, when the guest attempts to access the memory, the shadow
page table is used instead of the one managed by the guest.
6
2. V IRTUALIZATION
CPU
A new structure was introduced - Virtual machine control block (VMCB),
which represents a virtual machine inside the CPU. When a VMCB
is run (VMRUN instruction), CPU executes the following steps:
The VCMB structure also contains the desired CPL level, allow-
ing the virtual machine to run even at ring 0. However, some oper-
ations, such as direct device I/O are still prohibited and cause the
virtual machine to exit the guest state. After the exit, virtual machine
monitor may decide to change several fields in the VCMB, thus ef-
fectively emulating the I/O and execute VMRUN again.
Memory
Intel and AMD have also come with a mechanism to eliminate the
need for shadowing page tables. Extended Page Tables (Intel) and
Rapid Virtualization Indexing (AMD) are examples of secondary level
address translation, where the nested page tables are created and
maintained by the hardware. In this model, the hardware performs
both the translations from guest’s virtual address space to guest’s
physical address space and from guest’s physical address space to
host’s physical address space.
7
2. V IRTUALIZATION
2.2.4 VirtualBox
VirtualBox’s GUI
8
2. V IRTUALIZATION
9
2. V IRTUALIZATION
10
2. V IRTUALIZATION
Xen architecture
11
2. V IRTUALIZATION
it allows to specify a new root directory other than /. The process and
its children then can’t access files above the new root directory while
programs from elsewhere can still see inside the the new root. It a
crucial that none of the processes inside can obtain root privileges as
that can potentially allow them to break out of the specified direc-
tory. Such a procedure is often called jailbreak and could be easily
performed by issuing chroot again while leaving open a file descrip-
tor pointing to a file outside of the newly selected root directory.
Nowadays chroot is used to provide basic isolated environments
for testing unknown and unstable applications or for discovering un-
wanted dependencies. Package building tools like Pbuilder for De-
bian or Mock for Fedora also utilise chroot to provide isolation and
enable testing in different Linux distributions.
An advanced mechanism built on top of chroot is jail. It is avail-
able in FreeBSD since 2000 and adds isolation of process lists, sets
of users and networking. Jail can therefore define a new root user,
which has full control inside it, but cannot reach anything outside.
The limitations are in the form of inability to mount or unmount
filesystems or modifying the network configuration. Jails can be started,
stopped or restarted and with the use of ezjails utility, even archiving
and later restoring a jail is possible.
2.3.2 Namespaces
Namespaces are one of the key features of the Linux kernel for sup-
porting lightweight virtualization. "The purpose of each namespace
is to wrap a particular global system resource in an abstraction that
makes it appear to the processes within the namespace that they have
their own isolated instance of the global resource." [13] To get a better
understanding, I will focus at the individual types. Six namespaces
are currently available in Linux.
Mount namespace was the first one implemented and its behaviour
is quite intuitive. All the mounts/unmounts from the global names-
paces are visible in it. Mounts/unmounts which happen in the names-
pace remain invisible to all other namespaces including the global
one. However setting a master-slave relationship is also possible, to
allow propagation of mounted devices.
UTS(Unix timestamp sharing) allows to isolate gethostname(),
12
2. V IRTUALIZATION
13
2. V IRTUALIZATION
The clone() system call has added 6 new flags, one for each of the
namespaces, to allow the child process resulting from the call to start
in a newly created namespace.
14
2. V IRTUALIZATION
15
2. V IRTUALIZATION
16
2. V IRTUALIZATION
17
3 Docker
The idea behind Docker project is well expressed by the following
goal set by its development team: "To build the ’button’ that enables
any application to be built and deployed on any server, anywhere."
[14] At it’s core, Docker is an open-source platform which allows
applications to be deployed inside software containers. This start-
up from the Silicon Valley has quickly caught attention of IT-world
leading companies. Amazon, Google, Microsoft and Red Hat added
support for Docker to their platforms and continuously contribute to
the project.
But Docker is more than just a virtualization library, it abstracts
away the differences between operating systems distributions and
creates a standardized environment for developing applications. A
software developer can create a standardized application which be-
comes portable and can run everywhere where the Docker Engine
is installed. This saves a lot work for the author as it is no longer
necessary to support many different platforms and operating system
distributions. System administrators need to spend less time con-
figuring the application as it comes packed with all its dependen-
cies. The fact that each application runs in it’s own container solves
many common problems like completely uninstalling or replacing it
or when two applications require two different versions of the same
dependency.
Docker is a relatively new piece of technology, so it still comes
with some limitations. Firstly, it only supports application which can
be run on Linux, at least for now, although the recent partnership
with Microsoft may change things in the future. Docker also runs
natively only on Linux, and while it’s possible to use additional soft-
ware to run it on Windows or OSX, it still requires a virtual machine
to do so.
18
3. D OCKER
(Russian and Chinese most used search engines) have integrated Docker
into their cloud services.
Docker entered 2014 with completing a $15 million fund[15], al-
lowing it to heavily invest both in the open source project and planned
enterprise support as well as in expanding the community platform.
In April, LXC was dropped as the default execution environment in
favour of Docker’s own libcontainer. Next month, Ubuntu 14.04 be-
came the first enterprise grade Linux distribution to ship with Docker
natively packaged, bringing millions of Ubuntu servers no more than
three command away from using Docker containers. The version 1.0
was finally released in June at the first Docker-centric conference -
DockerCon. September brought the announcement that another ma-
jor fund of $40 million was raised[16], valuing the project at roughly
$400 million[17]. One month later, Docker and Microsoft declared
partnership with the goal of creating Docker Engine for Windows
Server and multi-Docker container model, including support for ap-
plications consisting of both Linux and Windows Docker containers.
In December the first official Docker conference in Europe took place
in Amsterdam, announcing several new Docker related projects as
well as Docker Hub Enterprise. Docker finished the year 2014 with
the release of 1.4, being the 24th most starred project on GitHub.
In February 2015, version 1.5 was released, bringing IPv6 sup-
port, read only containers and support of multiple Dockerfiles per
project. Shortly afterwards, a trio of orchestration tools was announced
: Docker Machine, Docker Swarm and Docker compose. The current
stable version(1.6) was released in April and came with the long ex-
pected Windows client and the ability to apply custom labels to im-
ages and containers.
19
3. D OCKER
move this drawback, so even regular users would be able to run con-
tainers.
By default, the server only listens on a Unix socket, making itself
unreachable over the network. This is a security feature, since any-
one who can access the daemon could easily take control of the en-
tire host. A trivial attack would be to run a container with mounted
host’s / directory. The container would then be able to rewrite any
host’s file. Therefore it is critical to only run Docker on public IP with
TLS, where each client is authenticated by a certificate from a trusted
certificate authority.
3.3 Libcontainer
20
3. D OCKER
21
3. D OCKER
Docker’s filesystem[12]
3.5 Security
Docker currently requires root privileges, therefore if it gets compro-
mised, the host will be exposed as well. I have showed an example
of such situation in the chapter about the Docker daemon. Mainly
because of this security threat, one of goals for Docker is the ability
for non-root users to run containers[2, p. 110]. Docker has already
announced that it’s working on it, changing the architecture to two
22
3. D OCKER
daemons. The current daemon will run in user space, while the priv-
ileged operations will be forwarded to a new service in kernel space.
In December 2014, Docker promoted a new feature called image
signing. It was long requested for images to contain a cryptographic
signature, so that they will be verified prior to running. However,
a detailed inspection of the implementation revealed that “Docker’s
report that a downloaded image is verified is based solely on the
presence of a signed manifest, and Docker never verifies the image
checksum from the manifest. An attacker could provide any image
alongside a signed manifest. “ [23] Even additional problems were
found such as badly constructed tarsum used for the image veri-
fication, processing the manifest after the image was extracted, or
the fact that if the manifest is incorrect only a warning is issued and
the image is still run. In response to the mentioned discoveries, the
Docker team initiated a security audit a promised to revise Docker’s
security.
The other potential threat to container based virtualization comes
with security issues in the Linux namespaces implementation. Namely,
bugs are being discovered in the user namespace, which hasn’t yet
been thoroughly tested in production as it was implemented quite
recently. An example of a recently discovered vulnerability is, that
process could potentially gain access to a filesystem entry, to which
even the user running it was denied access. This could be accom-
plished by the possibility of dropping supplementary groups from
within a user namespace. It could be achieved by calling setgroups,
which was possible prior to the existence of guid mapping (thus
having root privileges only in namespace). Several other vulnera-
bilities have also been reported and fixed in the recent months. Re-
cently, during a security fix in December 2014, one the kernel’s devel-
oper has warned, that “..while it seems possible to contain privilege
within a user namespace, there is always the possibility of surprises
like this one hiding in the corners of the system. It may be some time
yet before we can be truly confident that all of those surprises have
been found and that the unprivileged creation of user namespaces is
truly a safe thing to allow.” [24]
23
3. D OCKER
3.6 Performance
A detailed performance testing of Docker was done by IBM in Jan-
uary 2014. The tests comparing the Docker to virtual machines cov-
ered memory access, block I/O, networking and benchmarking Re-
dis and MySQL instances. Considering the differences between the
two virtualization technologies, the results confirmed what was ex-
pected: “Both VMs and containers are mature technology that have
benefited from a decade of incremental hardware and software op-
timizations. In general, Docker equals or exceeds KVM performance
in every case we tested. Our results show that both KVM and Docker
introduce negligible overhead for CPU and memory performance
(except in extreme cases).” [25] The tests have also revealed that the
performance of Docker can significantly differ depending on whether
it’s using the host’s network or a NAT bridge. Similarly, the overhead
is slower when data are stored on a shared volume rather than in the
union filesystem.
3.7 Future
Docker has inspired the creation of many projects, which take ad-
vantage of it’s functionality. While these projects are under develop-
ment, new ones are still emerging, as everyone wants to fill a gap in
the market as soon as possible. It yet remains to be seen, which ones
will emerge as winners from this competitive environment, but I will
mention the ones that seem to show the greatest premises.
Kubernetes
Google, undoubtedly one of the largest data centre operator, has also
admitted that every single one of their services runs inside a Linux
container [26]. While they have not yet shared their main internal
task scheduler - Omega, they have released another container man-
ager Kubernetes, as an open-source project. Currently, the containers
are run inside Docker, although support of rkt, which will be covered
in a later chapter, is planned as well.
Kubernetes introduces the concept of Pods - groups of contain-
24
3. D OCKER
ers that are relatively tightly coupled and are treated as the small-
est deployable unit. A common use case would be a main container
running a web application utilising several other containers with its
helper services. It makes sense for these containers to start/stop at
the same time and to run on the same host. Pods have usually at-
tached labels (key,value pairs) to them, which enables querying the
cluster nodes running a particular group of pods.
The next abstraction is Service - a label-defined groups of ports,
exposing the same port and running the same application. A pod
may stop running on a node and be replicated on another, so with
the use of a service, other pods doesn’t need to keep track, which
pod is running of which node, instead, they can use a virtual IP of
the service.
To support scaling, Kubernetes introduces replication controllers.
A replication controller uses a template, according to which the pods
are created and allows to set the numbers of pod replicas to be run-
ning. This can be used to easily increase or decrease the number
of the running instances of an application. Another use case would
the update of an application, when using one replication controller
for the old version and one for the new version, continuous uptime
could be achieved.
25
3. D OCKER
Kubernetes architecture
Mesos
26
3. D OCKER
CoreOS
27
3. D OCKER
28
3. D OCKER
Project Atomic
Project Atomic is a set of components which provide solutions for de-
ploying containerized applications. The main result of Project Atomic
are Project Atomic hosts, which are lightweight operating systems
based on either Red Hat Enterprise Linux, Fedora or CentOS. The
components included are most notably Docker, Kubernetes, SELinux,
rpm-ostree and Project Cockpit.
Rpm-ostree is yet another tool for providing atomic updates to
the operating system. A previous version is also stored for rollback-
ing purposes, since it works by placing the updated version in a
newly created filesystem root. The system then boots from the new
filesystem, keeping the previous version intact.
Project Cockpit is remote Linux server manager, which comes
with also contains a web based GUI. Its main benefit is providing
clean visualization of the server’s status, which is a great help for
new system administrators. Project Cockpit is expected to ship with
Fedora Server 21 as well.
Rkt
In December 2014, the CoreOS team has expressed its concern about
the direction the Docker project has taken and released a blog post,
which immediately caught attention. They expressed their disagree-
ment with how wide the scope of Docker has grown:
29
3. D OCKER
30
4 Using Docker
Ubuntu
CentOS, Fedora
Boot2Docker
31
4. U SING D OCKER
Windows
32
4. U SING D OCKER
OS X
Kitematic GUI
33
4. U SING D OCKER
34
4. U SING D OCKER
may come from the same repository and have the same version tag,
they may still be different, for example in the case of the tag “latest”.
The whole point of using Docker is of course, the virtualization
it brings, so when an image is run, Docker creates a container and
places the application from the image inside it. To run an image, one
can specify either the image’s ID, repository name with tag, or only
the repository name in which case, the default tag "latest" is used.
35
4. U SING D OCKER
36
4. U SING D OCKER
specifying the parent image and data volumes, exposing ports and
several other options. It is also possible to create a base image, either
by providing a tar archive of an existing filesystem to docker import
command, or specifying a special image called scratch (it contains an
empty filesystem) as parent image.
A sequence of Dockerfile instructions to dockerize an application
may look as following:
37
4. U SING D OCKER
The major differences between Docker Hub and a registry are, that
there is exactly one instance of Docker Hub (managed by Docker
Inc.) and it only handles user authentication and authorization plus
it contains the checksums of images, while there may be multiple reg-
istries which store Docker images. Docker Hub currently also hosts
the largest public registry, so sometimes the terms Docker Hub and
public registry are interchanged.
Docker Hub’s registry contains three kinds of repositories: offi-
cial repositories, which contain images from vendors and Docker
contributors; private repositories, where non-public images can be
kept; public repositories for sharing public images. As of April 2015,
Docker Hub’s public registry offered over 45 000 images, which means
that basically all major Linux software is already dockerized.
38
4. U SING D OCKER
39
4. U SING D OCKER
to the docker run command, which can add further restrictions for
picking the node to run the image. Such are restrictions are called
filters and may force or exclude the selection of a specific node by
name, available ports, operating system, kernel version, the node’s
storage type or place the container on the same node as some other,
already placed container.
40
4. U SING D OCKER
repetitive and possibly error prone task, to install every single com-
ponent manually, so a project called Fig was created. In February
2015, Fig was deprecated in favour of Docker Compose, which is
based on Fig’s code base.
The main idea is the ability to link several containers together,
allowing to compose a complex application from several images. It
uses a yaml configuration, which also allows to specify the settings
for exposing ports, passing environment variables and mounting data
volumes. A configuration may also extend an existing one, so for ex-
ample an application can have a simple common configuration plus
two specialized ones, one for development and the other one for
production. Docker compose works well with Docker Swam, where
linked containers are scheduled on the same host.
41
4. U SING D OCKER
able in many languages: C++, C#, Java, Python, Ruby, PHP, Go and
several more.
By default, the Docker daemon listens on a Unix socket and is
thus available only locally, however a TCP port may also be speci-
fied, by using the option -H when starting docker daemon or creat-
ing an environment variable with name DOCKER_HOST. Once the
Docker runs on a public TCP port, Docker Remote API may be used
to manage containers and images.
42
5 Implementation
The second part of this thesis focusing on practical experience with
Docker. Firstly, I will use Docker Remote API with a corresponding
client library to transfer a file between two Docker containers, each
running on a different host. The other task is to enhance Docker with
a new command, docker update which simplifies detection of out-
dated images.
Setup
I have decided to demonstrate the API’s power by programmatically
transferring a file over SCP using Docker-java. My setup consisted of
the following machines:
43
5. I MPLEMENTATION
Results
The code required to provide the transfer is very short, once a con-
nection to the container is established, the SCP command which does
the actual transfer is sent over to be executed. The file transfer proved
to be successful and happened swiftly, as was expected. Using the cat
command for printing the file contents it was immediately clean that
the new file on (A) is indeed a copy of the original one from (B).
44
5. I MPLEMENTATION
Developing Docker
Docker contribution workflow, which is in detail explained in the
official guide [35] , specifies the necessary tools, such as git, make and
docker. The guide covers every basic step from creating/claiming
an issue, though installing, compiling and testing up to making pull
requests. As a great communication tool and help for new Docker
developers an IRC channel #docker-dev is publicly available.
Except for the compilation time, which is mediocre (about half
a minute), development is quite fast, since it simply involves copy-
ing the new binary and restarting the docker service, which can be
all handled by an utility script. What is more complicated is testing,
since running the entire test suite can take several hours.
Docker’s code itself is mostly well structured and formatted, but
lacks enough comments. This is something that I feel should be im-
proved, since for example, it is often hard to tell a variable’s type,
considering Go’s dynamic type inference. What gives a very good
impression is Docker’s heavy error checking and frequent debug log-
ging. Another positive is the emphasis placed on project’s modular-
ity and loose coupling. I have also mentioned the tests, which are
present .
Our IDE choice was LiteIDE [36], a lightweight open source IDE
for Go. It is easy and intuitive to install and use, plus it offers a good
search mechanism. The not so outstanding features are code naviga-
tion, which seems to be working about half the time and code com-
pletion, which didn’t work in our installation at all.
45
5. I MPLEMENTATION
output
• Write unit tests for added functions, and an integration test for
the command
Summary
This command could be very beneficial for Docker to have as system
administrators will have a quick way of checking whether all of their
images are up to date. It would be also possible to build a notification
service, utilising the command, which could periodically check and
possibly pull updates for the images present in the system.
46
6 Conclusion
In my thesis, I have described both approaches to virtualization -
virtual machines and containers. In the case of virtual machines, the
principles were explored and various tools were described. It can be
stated that virtual machines have a long tradition, the technology is
widely used and mature and furthermore, the years of production
use have caused them to be thoroughly tested. Nevertheless, virtual
machines suffer from several drawbacks. They are often difficult to
set up and maintain, can take a lot of space on disc and even though
they are directly supported by the hardware, a performance hit still
occurs.
Container based virtualization works by sharing the operating
system’s kernel, eliminating these kind of problems. However it im-
portant to note, that containers are not able to fully replace virtual
machines yet. Running an entirely different guest operating system
is a frequently used feature of virtual machines, which the containers
don’t offer. Additionally, as the usage of containers spreads, security
bugs are being discovered in the underlying technologies, and even
if they are being fixed quickly, it will take some time before contain-
ers will become as much trusted and production tested as virtual
machines. Still, large companies have decided that containers are in-
deed what could dramatically improve performance and accessibil-
ity of their clouds and started adopting them.
Docker is a project which brings the containers closer to devel-
opers and system administrators. It comes with an easy to use in-
terface for container management and provides a healthy ecosystem
for sharing the containerized applications - images. Docker is on its
way to become a standard for handling containers, while introduc-
ing higher level tools for both applications and users. Rapidly evolv-
ing, Docker is quickly adding features, while trying to stay in contact
with its user base, in order to make sure containers will once earn the
same reputation as virtual machines. Moreover, dozens of projects
are being created on top of Docker, ranging from small extensions
to entire cloud operating systems. The following months and possi-
bly years will show, which ones will dominate the market and which
ones will fade into history.
47
6. C ONCLUSION
48
7 Appendix
49
Bibliography
[1] Navin Sabharwal, Bibin W. Hands on Docker, 2015.
[6] http://www.xenproject.org/users/why-the-xen-project.html,
cit. 23.4.2015.
[7] http://en.wikipedia.org/wiki/Libvirt#/media/File:Libvirt_support.svg,
cit. 12.5.2015
[8] http://virt-manager.org/wp-content/uploads/2013/04/virt-
manager-vm-list.png, cit. 12.5.2015
[12] https://docs.docker.com/terms/images/docker-filesystems-
multilayer.png, cit. 10.5.2015
[14] http://blog.docker.com/2014/10/docker-microsoft-partner-
distributed-applications/, cit. 11.1.2015
[15] http://techcrunch.com/2014/01/21/docker-raises-15m-for-
popular-open-source-platform-designed-for-developers-to-
build-apps-in-the-cloud/, cit. 12.1.2015.
50
BIBLIOGRAPHY
[17] https://gigaom.com/2014/08/06/the-400-million-container-
company-docker-closes-in-on-funding-round-of-over-40-
million/, cit. 12.1.2015
[18] https://chocolatey.org/packages/docker
[19] https://github.com/docker-library/java/blob/master/openjdk-
8-jdk/Dockerfile, cit. 6.4.2015.
[20] https://registry.hub.docker.com/
[21] https://github.com/docker/machine/blob/master/ROADMAP.md
[22] https://github.com/kwk/docker-registry-frontend
[26] http://googlecloudplatform.blogspot.sk/2014/06/an-
update-on-container-support-on-google-cloud-platform.html,
10.6.2014
[27] https://gigaom.com/2014/08/18/google-wants-to-show-the-
world-how-sexy-cluster-management-really-is/, cit 24.4.2015
[28] https://mesosphere.com/blog/2015/04/23/apple-details-j-a-
r-v-i-s-the-mesos-framework-that-runs-siri/, cit 24.4.2015
[31] https://github.com/docker/docker/commit/
0db56e6c519b19ec16c6fbd12e3cee7dfa6018c5, cit 26.4.2015
51
BIBLIOGRAPHY
[33] https://github.com/docker-java/docker-java
[34] https://github.com/docker/docker/issues/4239
[35] https://docs.docker.com/project/who-written-for/
[36] https://github.com/visualfc/liteide
52