Published at 15.11.2015
Table of Contents
Docker consists of the two main parts the Docker Engine and the Docker Hub. The Docker Engine is the core of Docker and you can think of it in terms of a container ship. Each application represents one container on this ship and the ship is our virtual machine. Docker groups several applications together and runs them as a single application. To distribute your built application, docker provides the Docker Hub service where you can upload and publish your application. Docker Hub is also the place, where you can find other projects you might want to use for yourself.
The first version of Docker was released in 2013 and just 15 months later it has been downloaded over 2.75 million times, reached 8,741 commits from more than 460 contributors and 14,000 “Dockerized” Apps. Docker is not directly a cloud solution but it’s an interesting building block technology.
We know what Docker is by now, but let us dig a little bit deeper and look at the architecture of Docker:
The Docker Client is the user interface to interact with Docker, e.g. Docker Quickstart Terminal. The user can use the Docker commands to run, build or distribute applications. The Docker Client interacts with the Docker Daemon of the Docker Host.
The Docker Host is the virtual machine and consists of the Docker Daemon and the containers.
The Docker Daemon runs in the Docker Host,communicates with the Docker Clients and reacts to the user input and starts the according events.
The Container is created from a Docker Image contains all necessary information and data of an application and is isolated from other containers. Docker uses a union filesystem to add layers to “version” your filesystem.
So the Container consists of:
I have already mentioned that Docker Images are used to build new Containers. Docker Image is a read-only (filesystem) template, it can contain an operating system like Ubuntu and other necessary Software. You can either create your own Docker Image or download one from other users.
The Union Filesystem or UnionFs enables you to join your physical distributed data branches into one virtual filesystem. You can mix read-only and writable branches that can be inserted or deleted anywhere in the tree.
**Further advantages of UnionFs are:
We know now that Docker Images are used to build new Containers. The Docker Registries hold these Docker Images. A Docker Registry is either a private or a public store where you download your Docker Image from. The Docker Hub is a public store of such sort.
At this point we’ve learned enough about Docker to start a container, so why don’t we run a Container and look what happens?
In order to do so, we use this Command in our Docker Terminal:
[code language=”bash”]docker run -i -t ubuntu /bin/bash[/code]
Now a Docker Container runs but what does this command actually do?
With “docker run” we basically communicate with the Docker Daemon and tell him to run a ubuntu image and as soon as the Container is running, it executes the command “/bin/bash” inside the Container.
In the background there are some more processes providing these function:Docker pulls the ubuntu image
Docker is written in Go and uses some Linux features like:
Namespaces capsules functionality into one resource, so it can be accessed from the outside only with the help of a namespace. As you can see namespaces help to isolate each container.
Some of the namespaces Docker uses are:
System V IPC, POSIX message queues
Network devices, stacks, ports, etc.
User and group IDs
Hostname and NIS domain name
Control Groups are a Linux Kernel Feature used to allocate hardware resources like Memory and assign them to your Containers.
The Container Format comprises the Namespaces, Control Groups and the UnionFS. The default container lib is called libcontainer. Alternative Formats like the traditional LXC are supported as well. In the future, further formats like BSD Jails and Solaris Zones will be also supported.
You can build your own application platform or PaaS with Docker
You can stay in control of what happens inside your containers (in contrast to Cloud Foundry where you delegate this)If you are interested with Docker and want to play with it, visit https://www.docker.com/tryit/
Neo4J is a NoSQL graph database which means the data is stored in a graph instead of tables. A graph consists of nodes and edges. A node consists of a key-value pair. You can label several nodes to group them. An edge between two nodes illustrates the relation between them. Relations can be traversed bidirectionally (even when being directed) and they can also have properties. You can query the graph (traverse it) and you can index the graph, so a query doesn’t need to traverse the whole graph.
Well…because the graphs are relevant! Think of Facebook’s social graph with its social search.
When we look at this diagram of a Neo4J graph we see several different units.
Traversing a graph means you visit the graph nodes. In most cases you declare rules, how a graph should be traversed and therefore most likely only a sub graph is visited.
Neo4j is a schema-optional graph database. You can use it either with a schema or without a schema. Schemas can produce performance and modeling benefits.
The purpose of an Index is to increase the Performance, so nodes can be looked up faster. Indices are the exact copies of the data so they cause additional storage. Indices are populated in the background.
Constraints are rules specifying how the data should look. If changes violate your constraints, Neo4J will prevent those changes. If you are in a transaction, your transaction is rolled back.
After we learned the basic concepts of Neo4J we look more exact at the Cypher Query Language.
Cypher is a graph query language that allows you to query and update the graph store. Cypher is designed to be a human understandable language, that’s why it uses ASCII art to make the query more visual and easier to understand. To express the “Like” relationship between node a and node b, Cypher illustrates it like:
There is also a Java Framework Traversal API, you can find it at https://neo4j.com/docs/stable/tutorial-traversal-java-api.html
To treat relations as first class citizens of your database. It allows you to traverse over relations very quickly since you never need to join. If you want more information, look at our blog about Neo4J.