Docker allows IT departments to focus on applications, not virtual machines, as a standard unit of production. Looking at recent trends, there have been many projects created by the Docker community that have advanced the developer experience. This article takes a look at a few Docker tools that may be useful for developers.
Docker was introduced to the world with no prior announcement, by Solomon Hykes, founder and CEO of dotCloud at the Python Developers Conference in Santa Clara, California on March 15, 2013. Hykes started Docker in France as an internal project within dotCloud, a PaaS company, with contributions from other dotCloud engineers including Andrea Luzzardi and Francois-Xavier Bourlet. The Docker project was quickly made open source and became available to the public on GitHub in March 2014, with the release of version 0.9.
Docker is an open source project that automates the deployment of Linux applications inside software containers.
As per the official website, docker.com, “Docker containers wrap up a piece of software in a complete file system that contains everything it needs to run: code, runtime, system tools, system libraries — anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in.”
Docker can be integrated into various infrastructure tools, including Amazon Web Services, Ansible, CFEngine, Chef, Google Cloud Platform, IBM Bluemix, Jelastic, Jenkins, Microsoft Azure, OpenStack Nova, OpenSVC, HPE Helion Stackato, Puppet, Salt, Vagrant and VMware vSphere integrated containers.
Key benefits of using Docker
Currently, Docker is regarded as the hottest open source project that allows users to deploy applications inside containers, adding a layer of abstraction. It is gaining a lot of traction in the development and DevOps worlds for its consistency across environments. Docker technology has seen consistent and rapid adoption in key enterprises like Microsoft, Google, etc, because of a number of advantages, which are listed below.
- Simple configuration: Docker provides simple configuration. VMs, too, can run on any platform with their own config on top of the infrastructure. Docker, however, offers the same capability without the overhead of a virtual machine. It lets the user put environment and configuration into code for deployment to be done. Docker gives the user freedom to run applications across multiple IaaS/PaaS solutions without any tweaks.
- Developer friendly: Docker provides a developer-friendly environment via a low memory capacity and allows easy running of dozens of services.
- Rapid application deployment: Containers include the minimal runtime requirements of the application, which reduces their size and allows them to be deployed quickly.
- Portability across machines: An application and all its dependencies can be bundled into a single container that is independent from the host version of the Linux kernel, platform distribution or deployment model. This container can be transferred to another machine that runs Docker, and executed there without compatibility issues.
- Version control and component reuse: Users can track successive versions of a container, inspect differences, or roll back to previous versions. Containers reuse components from the preceding layers, which makes them noticeably lightweight.
- Debugging capabilities: Docker provides many tools that are not necessarily specific to containers, but work well with the concept of containers. They also provide extremely useful functionality. This includes the ability to checkpoint containers and container versions, as well as to differentiate between two containers. This can be immensely useful in fixing an application.
- Multi-tenancy: Using Docker, it is easy and inexpensive to create isolated environments for running multiple instances of app tiers for each tenant. This is possible given the spin up speed of Docker environments and its easy-to-use API, which we can use to spin containers programmatically.
Open source Docker tools for developers
The success of any software project is often measured by the ecosystem it spawns. Projects built around, next to, and on the top of the core technology enhance its power and usability, and they often move the needle forward. Docker allows IT departments to focus on applications, not virtual machines, as a standard unit of production. Looking at recent trends, there have been many projects created by the Docker community that have advanced the developer experience. Although choosing among the great contributions is really difficult, here is a roundup of the most useful open source Docker tools for developers.
Kubernetes
Kubernetes is an open source container cluster manager designed by Google for managing containerised applications in a clustered environment. The objective behind the development of Kubernetes is to provide developers a strong platform for automatic deployment, scaling and operation of application containers across clusters of hosts, providing container-centric infrastructure.
Kubernetes is regarded as portable (public, private, hybrid and multi-cloud), extensible (modular, pluggable, hookable and composable) and self-healing (with auto-replacement, auto-restart, auto-replication and auto-scaling). It can schedule and run application containers on clusters of physical or virtual machines.
Kubernetes satisfies a number of common needs of applications for developers, like co-locating helper processes, mounting storage systems, distributing secrets, checking the application’s health, replicating application instances, horizontal auto-scaling, rolling updates, resource monitoring, log access and ingestion, and support for introspection and debugging.
Dockersh
Dockersh has been developed by Yelp as part of its testing and service management infrastructure suite. Dockersh is designed to be used as a login shell on machines with multiple interactive users. When a user invokes Dockersh, it brings up a Docker container, and then spawns a new interactive shell in the container’s namespace.
With Dockersh, users enter their own individual Docker containers (acting like a lightweight virtual machine), with the user’s home directory mounted from the host system (so that user data is persistent between container restarts), but with its own kernel namespaces for processes and networking. This means that the users are isolated from the rest of the system, and can only see their own processes respectively, and have their own network stack which, in turn, provides better privacy between users. Dockersh eliminates the need for any of these techniques by acting like a regular shell, which can be used in /etc/passwd or as an SSH ForceCommand.
Dockersh tries hard to drop all privileges as soon as possible, including disabling the suid, sgid, raw sockets and mknod capabilities of the target process.
Prometheus
Prometheus is an open source system-monitoring and alerting toolkit developed by SoundCloud. It addresses many aspects of monitoring such as generation and collection of metrics, graphing the results on dashboards, and raising alerts when anomalies occur. It works well for recording any purely numeric time series, and fits both machine-centric monitoring as well as highly dynamic service-oriented architectures.
Its components are:
- Prometheus server: Scraps and stores time series data
- Client libraries: Used for instrumenting application code
- Push gateway: Supports short-lived jobs
- GUI-based dashboard builder based on Rails/SQL
- Special-purpose exporters
- Alert manager, command querying tool and other tools
Prometheus is designed for reliability to allow users to quickly diagnose problems. The Prometheus server is standalone, and does not depend on network storage or other remote services.
The features of Prometheus are:
- A multi-dimensional data model (time series identified by the metric name and key/value pairs)
- A flexible query language to leverage this dimensionality
- Non-reliance on distributed storage; single server nodes are autonomous
- Time series collection happens via a pull model over HTTP
- Pushing time series is supported via an intermediary gateway
- Targets are discovered via service discovery or static configuration
- Multiple modes of graphing and dashboarding support
Docker Compose
Another useful tool for developers is Docker Compose. The prime importance of this tool is that it provides a base for running multi-container Docker applications, along with its dependencies, in single file. Also, applications can run with a single command. All the applications are defined in a YAML file, which comprises all the options used in ‘Docker run’.
Docker Compose is a three-step process:
- Defines your app’s environment with a Docker file so it can be reproduced anywhere.
- Defines the services that make up your app in docker-compose.yml, so that they can be run together in an isolated environment.
- Lastly, runs docker-compose up and Compose will start and run your entire app.
Kitematic
Kitematic is an open source project designed to simplify and streamline using Docker on a Mac or Windows system. Kitematic aims to make Docker useful as a desktop-environment developer’s tool. It makes the process of downloading Docker images, spinning them up, and managing them into a task no more difficult than, say, using VMs in an application like VMware Workstation.
The Kitematic GUI launches from the home screen and presents curated images that can run instantly. The user can search for any public image on Docker Hub from Kitematic just by typing in the search bar. The GUI is used to create, run and manage containers just by clicking on buttons. Kitematic allows you to switch back and forth between the Docker CLI and the GUI. Kitematic also automates advanced features such as managing ports and configuring volumes. Users can use Kitematic to change environment variables, stream logs, and single-click terminals into your Docker container — all from the GUI.
The features of Kitematic include:
- Fast and easy set-up: One-click install gets Docker running on your Mac, and lets users control app containers from the GUI.
- Docker Hub integration: Allows users to easily search favourite images on Docker Hub from Kitematic GUI to create and run your app containers.
- Seamless experience between the CLI and GUI: Enables users to seamlessly switch between Kitematic GUI or Docker CLI to run and manage your application containers.
- Advanced features: Automatically maps ports and visually changes environment variables, configuring volumes, streamline logs and CLI access to containers.
Logspout
Logspout is a great tool for managing logs generated by programs running inside Docker containers. It manages the log router for the Docker container by attaching all containers to a host, and consists of an extensible module system.
The size of Logspout is just 14MB and it has Busybox at its core, which enables developers to route all the logs of Docker containers to a central location like a single JSON object.
Flocker
Flocker is an open source container data volume orchestrator for Dockerised applications. It migrates data along with containers as they change hosts. Flocker gives users the tools they need to run containerised services like databases in production. Flocker manages Docker containers and data volumes together.
Flocker is designed to work with the other tools to build and run distributed applications. It can be used with popular container managers or orchestration tools like Docker, Kubernetes, Mesos, etc. Flocker supports block-based shared storage such as Amazon EBS or OpenStack Cinder to choose the storage back-end that is best for an application.
Its features are:
- Seamless database migrations for micro services
- Integrates into existing Docker workflow
- Runs multiple containers on multiple machines
- Easily moves between development, staging and production
The official website of Flocker is https://clusterhq.com/flocker/introduction/.
Powerstrip
Powerstrip, a new open source project from ClusterHQ, provides a useful platform for developers to build powerful Docker prototypes known as Powerstrip adapters. Multiple Powerstrip adapters can be integrated behind the familiar Docker CLI and API.
For example, you can have a storage adapter like Flocker running alongside a networking adapter such as Weave, all playing well with the orchestration framework you choose.
Powerstrip is implemented as a configurable, pluggable, HTTP proxy for the Docker API, which lets users plug multiple Docker extension prototypes into the same Docker daemon.
Powerstrip allows you to build Docker extensions by implementing chained blocking webhooks triggered by arbitrary Docker API calls. The objective behind Powerstrip development is to make it possible for a rich ecosystem of tool builders to offer specialised services, without forcing end users to choose between different Docker experiences.
Helios
Helios, an open source Docker orchestration platform, helps developers in the deployment and management of containers across a cluster of servers. It is equipped with an API based on HTTP as well as a command based client to connect to servers running Docker containers. Its key element is keeping track of event history, which includes varied information like Docker deployment, Docker restart and even updates or changes of any sort in the Docker version.