By William Le.
So what’s this ‘Docker’ thing I keep hearing about? What can it do for my application deployments and should I start using it?
Here at ACA, we use Docker to capture and abstract our own applications (CoTag Media and ACA Engine) and their operating environments for rapid deployment and extensive portability.
Docker is an exciting new software virtualisation technology that encapsulates applications into portable and immutable images that run as ‘containers’ than can quickly and easily be re-deployed across various flavours of Linux. The containers are much lighter weight than virtual machines both in terms of size (usually hundreds of megabytes instead of many gigabytes) and hardware requirements.
There is even an online repository of official and user-contributed Docker images - significantly reducing the installation and configuration time usually associated with the deployment of most of these applications.
To compare, let’s install and configure Elasticsearch with some plugins that we use:
Normal Ubuntu Elasticsearch Installation
sudo add-apt-repository ppa:webupd8team/javasudo apt-get update
sudo apt-get install oracle-java8-installer
java -version
wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.6.0.tar.gz
tar -xf elasticsearch-1.6.0.tar.gz
cd elasticsearch-1.6.0
sudo ./bin/plugin -install mobz/elasticsearch-head
sudo ./bin/plugin -install transport-couchbase -url http://packages.couchbase.com.s3.amazonaws.com/releases/elastic-search-adapter/2.0.0/elasticsearch-transport-couchbase-2.0.0.zip
./bin/elasticsearch
Docker Elasticsearch Installation
docker run --net=host aca0/elastic
As you can see, once you’ve created a Docker image that snapshots your desired application, its dependencies and configuration, download and execution can boil down to single line. This line can be added to a Linux service configuration unit (we use systemd on CoreOS) which makes for simplified service installation. Furthermore, your custom Docker images can inherit existing Docker images - image creation is rarely ever from scratch.
We customise our own Docker images (CoTag API, CoTag Video Processing, Couchbase, Elasticsearch, nginx, Redis and Watchmen) that automatically discover each other using etcd and talk to each other’s RESTful web services. During initial deployment, each of these images are automatically pulled from the cloud onto new servers and executed by a CoreOS cloud-config file.
A cluster of a dozen servers that would typically take several days to set up (including database redundancy, backup, service monitoring and outage notifications) can now be done by me alone within a few hours. If your company deploys their web applications for each new enterprise client, then you should definitely be checking out this technology.