Docket - Custom docker registry that allows for lightning fast deploys through bittorrent
Docket - Custom docker registry that allows for lightning fast deploys through bittorrent
DOCKEr + torrenT = Docket
Docket is a custom docker registry that allows for deployments through bittorrent. It allows for lightning fast Docker image deploys across large number of machines.
This was designed and built in 48 hours as part of the Gopher Gala Golang 48 hour hackathon. Hence kindly forgive me for the hackish code, and lack of tests.
[On hind sight - container rush or docker flood would have been a better name.]
As containers get more mainstream, server deployments are soon going to be done through a containerization solution like docker [or rocket or lxd].
Large scale deploys are going to choke your docker registry. Imagine pulling/deploying a 800mb base image (for example the official perl image) across 200 machines in one go. That's 800*200 = 160GB of data that's going to be deployed and it'll definitely choke your private docker registry (and will take a while pulling in from the public image)
The solution is BitTorrent. Any technology good for distributing music and movies, is usually good for doing server deploys. Instead of downloading from one point source, we can now distribute the load across the machines downloading themselves. All of this transparently and automatically handled by the docket client.
Pulling a 800 mb image across 5 machines simultaneously via Docket resulted in a 90% speedup.
Docket constitutes of 3 components:
A REST service that acts as a registry. It receives docker image tarballs from the client, stores metadata into a database, creates torrents out of them and seeds them.
The client itnerface in which the end user will be interacting. Can view available images in the registry, push an image to the registry and pull an image (which triggers a bittorrent deploy) from the registry.
Docket allows you to BYOT (bring your own tracker), but I suggest installing opentracker
Docket uses ctorrent for the actual downloading of torrents.
$ sudo apt-get update
$ sudo apt-get install zlib1g-dev make g++ ctorrent
$ git clone https://github.com/gebi/libowfat
$ make
$ git clone git://erdgeist.org/opentracker
$ cd opentracker
$ make$ wget http://storage.googleapis.com/docket/docket.zip
$ unzip docket.zip$ cd opentracker
$ ./opentracker 8940$ cd registry
# Note you need to put an ip address in which other machines can contact the tracker
# You cannot put in localhost or 127.0.0.1
$ sudo ./registry --tracker "10.240.101.85:8940"…$ cd client
$ sudo ./client -h "http://10.240.101.85" images
netvarun/test:latest
perl:latest
…./registry --help
usage: registry []
Docket Registry
Flags:
--help Show help.
-t, --tracker="10.240.101.85:8940"
Set host and port of bittorrent tracker. Example: -host 10.240.101.85:8940 Note: This cannot be set to localhost, since this is the tracker in which all the torrents will be created with. They have to be some accessible ip
address from outside
-p, --port="8000" Set port of docket registry.
-l, --location="/var/local/docket"
Set location to save torrents and docker images../client
usage: client [] [] [ ...]
Docket Client
Flags:
--help Show help.
-h, --host="http://127.0.0.1"
Set host of docket registry.
-p, --port="8000" Set port of docket registry.
-l, --location="/tmp/docket"
Set location to store torrents and tarballs.
Commands:
help []
Show help for a command.
push
Push to the docket registry.
pull
pull to the docket registry.
images []
display images in the docket registry.
Sivamani Varun ([email protected])
MIT License
No open issues yet, or sync has not completed.