139

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?

tshepang
  • 12,111
  • 21
  • 91
  • 136
James Lin
  • 25,028
  • 36
  • 133
  • 233

10 Answers10

599

Update: 2019-03-11

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:

Update 1

Another related project I recently discovered:

Update 2

The latest release Openstack contains support for managing Docker containers:

Update 3

System for managing Docker instances

And a presentation on how to use tools like Packer, Docker and Serf to deliver an immutable server infrastructure pattern

Update 4

A neat article on how to wire together docker containers using serf:

Update 5

Run Docker on Mesos using the Marathon framework

Mesosphere Docker Developer Tutorial

Update 6

Run Docker on Tsuru as it supports docker-cluster and segregated scheduler deploy

Update 7

Docker-based environments orchestration

maestro-ng

Update 8

decking.io

Update 9

Google kubernetes

Update 10

Redhat have refactored their openshift PAAS to integrate Docker

Update 11

A Docker NodeJS lib wrapping the Docker command line and managing it from a json file.

Update 12

Amazon's new container service enables scaling in the cluster.

Update 13

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:

https://clusterhq.com/

Update 14

A project to create portable templates that describe Docker applications:

http://panamax.io/

Update 15

The Docker project is now addressing orchestration natively (See announcement)

Update 16

Spotify Helios

See also:

Update 17

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.

Update 18

Rancher is a project that is maturing rapidly

http://rancher.com/

Nice UI and strong focus on hyrbrid Docker infrastructures

Update 19

The Lattice project is an offshoot of Cloud Foundry for managing container clusters.

Update 20

Docker recently bought Tutum:

https://www.docker.com/tutum

Update 21

Package manager for applications deployed on Kubernetes.

http://helm.sh/

Update 22

Vamp is an open source and self-hosted platform for managing (micro)service oriented architectures that rely on container technology.

http://vamp.io/

Update 23

A Distributed, Highly Available, Datacenter-Aware Scheduler

From the guys that gave us Vagrant and other powerful tools.

Update 24

Container hosting solution for AWS, open source and based on Kubernetes

https://supergiant.io/

Update 25

Apache Mesos based container hosted located in Germany

https://sloppy.io/features/#features

And Docker Inc. also provide a container hosting service called Docker cloud

https://cloud.docker.com/

Update 26

Jelastic is a hosted PAAS service that scales containers automatically.

Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • 1
    openstack is another candidate for this list – ben schwartz Dec 14 '13 at 23:35
  • @benschwartz Very true, but only in the latest release. – Mark O'Connor Dec 15 '13 at 03:42
  • @ElGamed Seen it, but haven't used it. Added to the list, thx! – Mark O'Connor Jun 09 '14 at 09:34
  • 2
    @MarkO'Connor The `mesosphere/mesos-docker` project has been deprecated and replaced by `mesosphere/deimos`: https://github.com/mesosphere/deimos – Ross Allen Jun 23 '14 at 23:16
  • 1
    Also worth looking at, from Google - https://github.com/GoogleCloudPlatform/kubernetes – mjsalinger Jul 23 '14 at 14:50
  • @MarkO'Connor The Mesosphere/deimos has been deprecated and Docker support is built into the core of Mesos. – Ken Aug 29 '14 at 16:09
  • @Ken Ah yes, thx for the update. I have updated the Docker tutorial link as well based on the 0.20.0 release of Mesos. – Mark O'Connor Aug 29 '14 at 17:21
  • There's now https://github.com/iorga-group/docker-cmd inspired by decking.io but with a pure docker DSL – Anthony O. Oct 03 '14 at 09:38
  • update 4 link is out of date, here is new one http://www.centurylinklabs.com/decentralizing-docker-how-to-use-serf-with-docker/ – mhoglan Dec 14 '14 at 19:02
  • Still waiting for the 'state-of-the-art' project :-/ – Simon Fakir May 14 '15 at 02:05
  • Shipyard is cool, but not up-to-date. It's currently not supporting volume mapping and container linking, also it does not support template tools (like docker compose). So if you're slightly changing your docker container configuration (aka Dockerfile) you have to enter aaall details in the webmask again. – derFunk Jul 24 '15 at 15:30
  • @derFunk This is an old answer now and Docker is moving fast. At the time Shipyard was amazing, now I'd recommend checking out Rancher which has container linking and load balancing. – Mark O'Connor Jul 25 '15 at 07:34
  • Thanks Mark, I've been researching alternatives the past weeks but didn't come across Rancher. Will give it a try (also they should improve their SEO :)) – derFunk Jul 25 '15 at 07:38
  • I'd add http://lattice.cf which is rapidly evolving towards 1.0, its the child of cloud foundry and enables scalable, highly available, load balanced docker workloads - similar to kubernetes – Stuart Charlton Sep 19 '15 at 01:18
  • Worth mentioning tutum here now? – Alexander Trauzzi Nov 18 '15 at 17:09
  • @Omega Certainly now that tutum are intending to offer it as a private cloud option. – Mark O'Connor Nov 18 '15 at 18:56
  • No love for HashiCorp's Nomad? :) – krish7919 Jul 20 '16 at 11:19
  • Did anyone mention docker services? Once a service is defined in a swarm, scaling is as simple as adding new hosts for resource additions and changing the replica count for container scale – Dockstar Dec 03 '16 at 21:08
  • @Dockstar Added mention of Docker cloud as you suggested – Mark O'Connor Sep 07 '17 at 08:45
  • Jelastic PaaS should be added, as it provides automatic scaling for containers https://jelastic.com/blog/docker-swarm-auto-clustering-and-scaling-with-paas/ – Tetiana Apr 06 '18 at 14:48
42

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

To see this in action, check out the terminal video at http://deis.io/overview/. You can also learn about Deis concepts or jump right into deploying your own private PaaS.

gabrtv
  • 3,558
  • 2
  • 23
  • 28
19

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/

Magno Torres
  • 530
  • 4
  • 7
17

Have a look at Rancher.com - it can manage multiple Docker hosts and much more.

Community
  • 1
  • 1
dublx
  • 11,978
  • 1
  • 14
  • 11
  • Rancher is open source, and includes a full distribution of Kubernetes. It provides a platform for running many different clusters, managing infrastructure and dramatically simplifies running containers. – Shannon Williams Jan 26 '17 at 20:31
9

A sensible approach to scaling Docker could be:

  1. Each service will be a docker container
  2. Intra container service discovery managed through links (new feature from docker 0.6.5)
  3. Containers will be deployed through Dokku
  4. Applications will be managed through Shipyard which in its turn is using hipache

Another docker open sourced project from Yandex:

tommasop
  • 18,495
  • 2
  • 40
  • 51
2

Openshift guys also created a project. You can find more information here, try test container and detailed info here . The only problem is the solution is Redhat centric for now :)

Kunthar
  • 472
  • 1
  • 5
  • 15
2

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:

https://github.com/longshoreman/longshoreman

Decker from the CloudCredo folks, using CloudFoundry:

http://www.cloudcredo.com/decker-docker-cloud-foundry/

As for straight up orchestration, NewRelic's opensource Centurion project seems quite promising:

https://github.com/newrelic/centurion

IanBlenke
  • 376
  • 1
  • 5
1

Take a look also at etcd and Consul.

Ricardo Silva
  • 815
  • 10
  • 12
1

Panamax: Docker Management for Humans. panamax.io

Fig: Fast, isolated development environments using Docker. fig.sh

rus1
  • 572
  • 5
  • 10
1

One option not mentioned in other posts is Helios. It is built by spotify and does not try to do too much.

https://github.com/spotify/helios

Chris Dail
  • 25,715
  • 9
  • 65
  • 74