└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Serverless Docker 2 | 3 | Swarm makes it incredibly easy to run code on your infrastructure. You wrap some code up inside a Docker container, and Swarm will make it run on whatever free resources you have. 4 | 5 | But what if those containers could also run other containers on a Swarm? We could put pieces of our application inside containers that are run on-demand on a Swarm. Docker containers can be used as functions from within other applications: 6 | 7 | ```python 8 | >>> import dockerrun 9 | >>> client = dockerrun.from_env() 10 | >>> client.run("bfirsh/leftpad", ["foo", "5"]) 11 | ' foo\n' 12 | ``` 13 | 14 | Take, for example, running background tasks in a web app. In a traditional architecture, you would have a set of task workers and a message queue to pass work from the web frontends to the task workers. 15 | 16 | If your web frontends have access to a Swarm, you can run the task directly on your Swarm: 17 | 18 | ```python 19 | client.run("tasks/reticulate-splines", detach=True) 20 | ``` 21 | 22 | To read more about this, [check out this blog post](https://blog.docker.com/2016/06/building-serverless-apps-with-docker). 23 | 24 | ## Examples 25 | 26 | - [Serverless voting app](https://github.com/bfirsh/serverless-docker-voting-app) – A serverless web app 27 | - [go-dexec examples](https://github.com/ahmetalpbalkan/go-dexec/tree/master/examples) 28 | - [Funker](https://github.com/bfirsh/funker-example-voting-app) – an example app that uses Funker to do processing in the background 29 | 30 | ## Reading 31 | 32 | - [Introducing dexec](https://ahmetalpbalkan.com/blog/dexec/) – What if the Go os/exec library could containerize? 33 | 34 | ## Tools 35 | 36 | - [Funker](https://github.com/bfirsh/funker) – Functions as Docker containers 37 | - [go-dcgi](https://github.com/bfirsh/go-dcgi) – CGI, but with Docker containers 38 | 39 | ## Client libraries 40 | 41 | - [docker-py](https://github.com/docker/docker-py) – Run Docker containers from Python apps 42 | - [dockerrun](https://github.com/bfirsh/dockerrun) – A simpler interface for running Docker containers in Python (soon to be part of docker-py) 43 | - [go-dexec](https://github.com/ahmetalpbalkan/go-dexec) – Like Go os/exec package but for Docker 44 | - [dockerode](https://github.com/apocas/dockerode) – Run Docker containers from Node.js apps 45 | - [docker-java](https://github.com/docker-java/docker-java) – Run Docker containers from Java apps 46 | 47 | ## Stuff that needs working on 48 | 49 | We need your help! 50 | 51 | - Make this work with Docker 1.12. 52 | - A proxy that scopes a Docker API so that containers can securely manage and run "child" containers. 53 | - Helpers for injecting the Docker API socket into containers that are run. 54 | - A server for running scheduled / cron jobs as Docker containers on a Swarm. 55 | --------------------------------------------------------------------------------