How to scale Docker containers in production
So I recently discovered this awesome tool, and it says
Docker is an open-source project to easily create lightweight, portable, self-sufficient containers from any application. The same container that a developer builds and tests on a laptop can run at scale, in production, on VMs, bare metal, OpenStack clusters, public clouds and more.
Let's say I have a docker image which runs Nginx and a website connects to external database. How do I scale the container in production?
First of all thanks for those who have upvoted this answer over the years.
Please be aware that this question was asked in August 2013, when Docker was still a very new technology. Since then: Kubernetes was launched on June 2014, Docker swarm was integrated into the Docker engine in Feb 2015, Amazon launched it's container solution, ECS, in April 2015 and Google launched GKE in August 2015. It's fair to say the production container landscape has changed substantially.
The short answer is that you'd have to write your own logic to do this.
I would expect this kind of feature to emerge from the following projects, built on top of docker, and designed to support applications in production:
Another related project I recently discovered:
The latest release Openstack contains support for managing Docker containers:
System for managing Docker instances
A neat article on how to wire together docker containers using serf:
Docker-based environments orchestration
Redhat have refactored their openshift PAAS to integrate Docker
A Docker NodeJS lib wrapping the Docker command line and managing it from a json file.
Amazon's new container service enables scaling in the cluster.
Strictly speaking Flocker does not "scale" applications, but it is designed to fufil a related function of making stateful containers (running databases services?) portable across multiple docker hosts:
A project to create portable templates that describe Docker applications:
The Docker project is now addressing orchestration natively (See announcement)
The Openstack project now has a new "container as a service" project called Magnum:
Shows a lot of promise, enables the easy setup of Docker orchestration frameworks like Kubernetes and Docker swarm.
Rancher is a project that is maturing rapidly
Nice UI and strong focus on hyrbrid Docker infrastructures
The Lattice project is an offshoot of Cloud Foundry for managing container clusters.
Docker recently bought Tutum:
Package manager for applications deployed on Kubernetes.
Vamp is an open source and self-hosted platform for managing (micro)service oriented architectures that rely on container technology.
A Distributed, Highly Available, Datacenter-Aware Scheduler
From the guys that gave us Vagrant and other powerful tools.
Container hosting solution for AWS, open source and based on Kubernetes
Apache Mesos based container hosted located in Germany
And Docker Inc. also provide a container hosting service called Docker cloud
Jelastic is a hosted PAAS service that scales containers automatically.
Deis automates scaling of Docker containers (among other things).
Deis (pronounced DAY-iss) is an open source PaaS that makes it easy to deploy and manage applications on your own servers. Deis builds upon Docker and CoreOS to provide a lightweight PaaS with a Heroku-inspired workflow.
Here is the developer workflow:
deis create myapp # create a new deis app called "myapp" git push deis master # built with a buildpack or dockerfile deis scale web=16 worker=4 # scale up docker containers
Deis automatically deploys your Docker containers across a CoreOS cluster and configures the Nginx routers to route requests to healthy Docker containers. If a host dies, containers are automatically restarted on another host in seconds. Just browse to the proxy URL or use deis open to hit your app.
Some other useful commands:
deis config:set DATABASE_URL= # attach to a database w/ an envvar deis run make test # run ephemeral containers for one-off tasks deis logs # get aggregated logs for troubleshooting deis rollback v23 # rollback to a prior release
You can try Tsuru. Tsuru is a opensource PaaS inspired in Heroku, and it is already with some products in production at Globo.com(internet arm of the biggest Broadcast Television Company in Brazil)
It manages the entire flow of an application, since the container creation, deploy, routing(with hipache) with many nice features as docker cluster, scaling of units, segregated deploy, etc.
Take a look in our documentation bellow: http://docs.tsuru.io/
Here our post covering our environment: http://blog.tsuru.io/2014/04/04/running-tsuru-in-production-scaling-and-segregating-docker-containers/
Have a look at Rancher.com - it can manage multiple Docker hosts and much more.
A sensible approach to scaling Docker could be:
- Each service will be a docker container
- Intra container service discovery managed through links (new feature from docker 0.6.5)
- Containers will be deployed through Dokku
- Applications will be managed through Shipyard which in its turn is using hipache
Another docker open sourced project from Yandex:
While we're big fans of Deis (deis.io) and are actively deploying to it, there are other Heroku like PaaS style deployment solutions out there, including:
Longshoreman from the Wayfinder folks:
Decker from the CloudCredo folks, using CloudFoundry:
As for straight up orchestration, NewRelic's opensource Centurion project seems quite promising:
Panamax: Docker Management for Humans. panamax.io
Fig: Fast, isolated development environments using Docker. fig.sh
One option not mentioned in other posts is Helios. It is built by spotify and does not try to do too much.