Powerstrip: prototype Docker extensions today

Luke Marsden
Posted by Luke Marsden
February 2, 2015 / Comments

Hacking on Powerstrip

Today we’re pleased to announce Powerstrip, a new open source project from ClusterHQ that lets you build prototypes of Docker extensions, called Powerstrip adapters.

Multiple Powerstrip adapters can seamlessly combine behind the familiar Docker CLI and API. For example, you can have a storage adapter (e.g. Flocker) running alongside a networking adapter (e.g. Weave), all playing nice with your choice of orchestration framework.

Crucially for the community, this immediately enables composition and experimentation with prototypes of Docker extensions.

“There is a huge demand for customizing and extending Docker without breaking its standard API. Hundreds of Docker contributors are collaborating to make it happen. Powerstrip will help them experiment faster, without having to patch and rebuild Docker every time. It’s a huge time saver and will help us find the right design faster. A must have if you’re into hacking and customizing Docker” — Solomon Hykes, CTO at Docker

Powerstrip is implemented as a configurable, pluggable HTTP proxy for the Docker API which lets you plug multiple Docker extension prototypes into the same Docker daemon. It is intended to allow quick prototyping in order to figure out which integration points are needed in order to turn such prototypical adapters into real Docker extensions. Inspired by this GitHub issue, Powerstrip allows you to build Docker extensions by implementing chained blocking webhooks triggered by arbitrary Docker API calls.

The following diagram shows how multiple adapters can inject blocking pre- and post-hooks on a Docker API request:

Powerstrip architecture

The following hypothetical example shows how a Powerstrip-enabled Docker Swarm with Flocker and Weave both loaded as extensions might look:

version: 1
  "POST /*/containers/create":
    # adapters are applied in list order
    pre: [flocker, weave]
    post: [weave, flocker]
  "DELETE /*/containers/*":
    pre: [flocker, weave]
    post: [weave, flocker]
    flocker: http://flocker/flocker-adapter
    weave: http://weave/weave-adapter

Such integrations form the basis, for example, for an orchestration framework to move (reschedule) stateful containers while their Weave IP and Flocker volumes move around with them.

The Powerstrip configuration file can match any of the Docker API endpoints. This enables you to modify any Docker behaviour and means Powerstrip will adapt easily to future changes in the Docker HTTP API.

Why did we create Powerstrip?

At ClusterHQ we are participating in the ongoing effort in the Docker community to add an extensions API to Docker. The goal of this project is make it possible for a rich ecosystem of tool builders to offer specialized services without forcing end-users to choose between different Docker experiences. Currently, the only way to build Docker extensions for something like storage or networking is to wrap the Docker API. This means that multiple extensions can’t be used together, and the tool builders must reimplement the Docker API to expose a familiar interface to the user.

While the important work of building this extensions API happens in the open, there is interest from the community to start prototyping extensions today. So in order to enable the whole community to prototype and experiment faster, we are open sourcing Powerstrip, a tool for prototyping Docker extensions.

What can you do with Powerstrip today?

Start prototyping Docker extensions! A Powerstrip adapter was just released for Weave, the Docker networking service. You can read a blog here.

“With Powerstrip we look forward to helping customers combine Docker, Weave and Flocker, towards killer use cases like live container migration. This is a big step for the Docker ecosystem working together. What is especially awesome is that Powerstrip makes it possible for any developer to enhance docker using the tools of their choice – for example node.js instead of go.” — Alexis Richardson, CEO Weaveworks

At ClusterHQ, we are working on our own Powerstrip adapter for managing data volumes. Check out how powerstrip-flocker will work in this video:

Currently, Powerstrip itself is written in Python using Twisted, however you can write Powerstrip plugins in any language you choose.

For those who want to work on improving Powerstrip in Go, we are collaborating with Jeff Lindsay of recently formed Glider Labs. Jeff was immediately excited by the project, saying:

“Powerstrip is extremely clever and an important step towards a future of extensibility in the Docker ecosystem.” — Jeff Lindsay

If the idea of building Docker extensions today sounds good, head over to GitHub and check out an example of how to build a simple Powerstrip adapter for the Docker API.

The readme also has a list of Powerstrip adapters proposed by the community. If you would like to build an adapter, just submit a pull-request to have your adapter added to the list. We’d love to have you.

Importantly, Powerstrip is a tool for prototyping Docker extensions so the community knows which API endpoints Docker needs to expose in order to enable rich functionally. That means feedback. Get involved at #clusterhq or the official Docker Extensions discussion at #docker-extensions, both on Freenode.

Join the discussion over on HackerNews.

More Powerstrip demos


About Flocker

Flocker is an open-source container data volume manager for your Dockerized application. It gives ops teams the tools they need to run containerized stateful services like databases in production.
Vote on Hacker News