/ Docker

Docker Architecture and Ecosystem

Docker Architecture and Ecosystem

Until recently, most of the cloud platforms were based on virtual machines which encapsulate guest operating systems alongside the libraries and the software applications. However, Linux containers are considered operating system level virtualization which provides isolated user-space instances, and processes on a single host machine (sharing the same Linux kernel). Containerization has made it clear that it is the future regarding software containerization in the cloud.

Docker as a tool was built as an abstraction on top of the low-level Linux containers allowing easy programmatic creation and distribution of container images, in addition to launching and deploying containers. It provides a command line tool and HTTP API which makes managing containers easy and automatable. Docker containers ship with the containerized software applications’ dependencies which keeps the deployment process the same regardless of the technology or the Linux distribution running the container. This standardized unit of the application and its dependencies is the Docker image, which is a layered immutable approach to creating images. Docker encompasses an ecosystem of other tools and services such as Docker Hub which is a central repository that hosts Docker images.

Docker is a client-server application with a number of components.

  • Docker Engine: The core of the Docker platform.
  • Docker Client: Is the client which will accept the calls from the command line and send them to the Docker Daemon via HTTP or TCP socket regardless of the hosting machine (same or different). However, it will not interact with the images and containers directly.
  • Docker Host: The server-side of the Docker Engine which contains the Docker Daemon, the images, and the containers. It exposes an HTTP API for managing containers and images.
  • Docker Daemon: The process that interacts with the images and the containers that are hosted on the same Docker Host.
  • Docker Registry: A remote service that host and publish Docker images. Docker Hub is the official Docker Registry, and most of the common applications, programming language runtimes, and databases have official Docker Hub images.
  • Docker Machine: Command line tool that is used to create and manage Docker Hosts which can be controlled by the local Docker Client.
  • Docker Swarm: Clustering tool to administer a group of Docker Hosts acting as a single Docker Host. The communication is through an API that is quite similar to the Docker API. The Docker Swarm API is used by the Docker Client.
  • Docker Compose: Specifies and groups containers to run and network together.

These are the main Docker components in its ecosystem, but there are much more.

Installing Docker Components

First, Docker Engine component must be installed in order to be able to install the rest. However, because the server is running Ubuntu Trusty 14.04, some packages are recommended to be installed such as linux-image-extra-* packages that allow Docker to use aufs storage drivers.

sudo apt-get install \
linux-image-extra-$(uname -r) \
linux-image-extra-virtual

As most of the packages on Debian distributions, Docker could be installed using repositories or by downloading the DEB package and install it manually. However, the former approach is much better as it eases up the installation and upgrading.

Docker has both Enterprise and Community Editions. However, the Community Edition will be installed here starting by allowing apt to use a repository over HTTPS.

sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common

Then adding the Docker’s official GPG key.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

After that, the following command will setup the stable repository.

sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

Finally, updating apt package index and installing Docker Engine. The VERSION should be the Docker version. Specifying the version of Docker recommended on production systems.

sudo apt-get update
sudo apt-get install docker-ce=VERSION

Docker Daemon binds to a Unix socket that is used by root user, so other users need to use sudo in order to use the Docker commands. To avoid using sudo each time, a docker group could be created, and the user could be added to it.

sudo groupadd docker
sudo usermod -aG docker $USER

It is also recommended to run Docker on system boot, and this could be achieved using systemd or upstart.

sudo systemctl enable docker

Secondly, the Docker Machine will be installed. It is worth mentioning that Docker Machine usually installed automatically if Docker is installed on Mac or Windows, or by installing Docker Toolbox (old solution for Windows and Mac).

To install Docker machine, the binary should be downloaded and extracted to the PATH.

curl -L https://github.com/docker/machine/releases/download/v0.10.0/docker-machine-
`uname -s`-`uname -m` >/tmp/docker-machine &&
chmod +x /tmp/docker-machine &&
sudo cp /tmp/docker-machine /usr/local/bin/docker-machine

By running the following command, the installation could be tested if it was successful.

docker-machine version

It will basically return the version of the Docker machine.

Finally, Docker Compose also installed by default for Windows and Mac users, but not for Linux. The following command shows how to download the binary.

curl -L "https://github.com/docker/compose/releases/download/1.11.2/docker-compose-
$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Then, the binary should be granted executable permissions.

chmod +x /usr/local/bin/docker-compose

To check if the installation was successful, the version of Docker Compose could be verified.

docker-compose --version
Anas Shekhamis

Anas Shekhamis

A software engineer who specializes in architecting and developing web applications. On a daily basis, I use Python, JavaScript, Ruby, and PHP to design and implement API's and build web applications.

Read More
Docker Architecture and Ecosystem
Share this