anynines website



Michael Reimsbach

Published at 15.11.2015

Cloud Native

Get To Know Docker and Neo4j

Table of Contents

What is Docker?

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.

Why is Docker relevant?

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.

But how does Docker works?

We know what Docker is by now, but let us dig a little bit deeper and look at the architecture of Docker:


]( Client

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.

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:

  • OS (image)
  • user files
  • metadata

Let’s Summarize:

  1. Create a Docker Image or download one
  2. Create your Container
  3. That’s all!
What are Docker Images?

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.

Union Filesystem

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:

  • the elimination of duplications
  • partial error conditions
Docker Registries

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

  • Creates a new Container
  • Allocates fs and mounts rw layer
  • Allocates a net / bridge interface
  • Setup IP Address
  • Executes process (/bin/bash)
  • Captures and provides app output
Docker Container Isolation

Docker is written in Go and uses some Linux features like:

  • Namespaces

  • Control Groups

  • Union Fs

  • Container format


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.


Mount points


Process IDs


User and group IDs


Hostname and NIS domain name

Control Groups

Control Groups are a Linux Kernel Feature used to allocate hardware resources like Memory and assign them to your Containers.

Container Format

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.

What do I need Docker for?

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

What is Neo4J?

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.

Why is Neo4J relevant?

Well…because the graphs are relevant! Think of Facebook’s social graph with its social search.

How does Neo4J works?

![How does Neo4j work]((

When we look at this diagram of a Neo4J graph we see several different units.


  • Fundamental unit to form a graph
  • Can have properties
  • Often used to represent entities (although – depending on the domain model – also relations could be meaningful to do so)
  • Can have 0..* labels


  • Fundamental unit to form a graph
  • Link nodes
  • Can have properties
  • Relations can be traversed bi-directionally (even when they are directed)
  • Reflexive relations are allowed
  • Relation can be typed > similar to labels for Nodes


  • Properties = key-value pairs
  • Key = string
  • Value = primitive or array
  • Types: boolean, byte, short, int, long, float, double, char, String


  • Labels are used to group nodes
  • Nodes with the same label belong to the same set > Can be used in queries
  • A node may have 0..* labels • Used when defining constraints/indices.


  • A path is one or more nodes connected by relations
  • Typically retrieved as a query or traversal result


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 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:
(a) -[:LIKE]->(b)

There is also a Java Framework Traversal API, you can find it at

What do I need Neo4J for?

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.

You can visit:

© anynines GmbH 2024


Privacy Policy


© anynines GmbH 2024