Michael Reimsbach
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:
](https://a9s-int-blog-cms.s3.amazonaws.com/screen_shot_2015_09_29_at_13_40_34_ccd47710e7.png)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.
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:
Let’s Summarize:
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
Control Groups
Union Fs
Container format
Namespaces
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:
Namespace
Isolates
IPC
System V IPC, POSIX message queues
Network
Network devices, stacks, ports, etc.
Mount
Mount points
PID
Process IDs
User
User and group IDs
UTS
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.
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.
![How does Neo4j work]((https://a9s-int-blog-cms.s3.amazonaws.com/pasted_image_1_c1ad9e5581.png)
When we look at this diagram of a Neo4J graph we see several different units.
Node:
Relationship:
Property:
Labels
Path:
Traversing:
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.
Schema:
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.
Index:
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:
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:
(a) -[:LIKE]->(b)
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.
© anynines GmbH 2024
Products & Services
© anynines GmbH 2024