Package: redock
Redock is a human friendly wrapper aroundDocker, theLinux container
engine. Docker implements a lightweight form ofvirtualizationthat makes it
possible to start and stop “virtual machines” in less than a second. Before
Docker the use of virtualization meant conventional virtual machines with all
of the associated bloat. Docker makes it ridiculously cheap and fast to
start/save/kill containers. This opens up exciting new possibilities for
DevOps:Complex build environments can be split up into isolated containers where
each container is concerned with the build requirements of a single project.
If a project’s build goes out of hand you just trash the container and go on
your merry way :-)The correctness of automated deployment systems (and distributed systems in
general) can be verified by using containers to host the configuration
management server and agents.To be honest, Docker is so fast that I could imagine myself building a test
suite of a complete cluster on top of it.The last point is the reason why I started working on Redock. In my initial
experiments withDockerI found a lot of sharp edges (both in the lack of
documentation and in the implementation ofDockerand its Python API) but at
the same time my fingers were itching to wrap Docker in an easy to use and
human friendly wrapper to try and unleash its potential.What Redock gives you is Docker without all the hassle: When you create a
container, Redock will install, configure and start anSSHserver and open
an interactive SSH session to the container. What you do with the container
after that is up to you…StatusRedock should be considered alpha quality software. So far it has been used by
a single person (me). Right now it’s intended for development work, not
production use. This might change over time, depending on my experiences with
Docker over the coming weeks / months (I’m specifically concerned with
stability and performance).By the way the same can and should be said aboutDocker(its site says as
much). During heavy testing of Redock I’ve experienced a number of unhandled
kernel mode NULL pointer dereferences that didn’t crash the host system but
certainly also didn’t inspire confidence ;-). It should be noted that these
issues didn’t occur during regular usage; only heavy testing involving the
creation and destruction of dozens of Docker containers would trigger the
issue.There’s one thing I should probably mention here as a disclaimer: Redock
rewrites your SSH configuration (~/.ssh/config) usingupdate-dotdee. I’ve
tested this a fair bit, but it’s always a good idea to keep backups (hint).I’m currently using Redock on Ubuntu 12.04 with Docker 0.6.3 and a Linux 3.8.0
kernel (as suggested in Docker’sinstallation instructionsfor Ubuntu). I’ve
only just switched to these versions and it seems they may have solved the
stability issues I mentioned above (time will tell :-).UsageYou will need to haveDockerinstalled before you can use Redock, please refer
to Docker’sinstallation instructions. You may also want to add your user
account to thedockergroup so you can connect to Docker withoutsudo(this took me a while to realize when I switched to Docker 0.6 :-). After
you’ve installed Docker you can install Redock using the following command:$ pip install redockThis downloads and installs Redock usingpip(the Python package manager).
Redock is written in Python so you need to have Python installed. Redock pulls
in a bunch ofdependenciesso if you’re familiar withvirtual environmentsyou might want to use one :-). Once you’ve installed Docker and Redock, here’s
how you create a container:$ redock start testIf you run this command interactively and you start a single container, Redock
will start an interactiveSSHsession that connects you to the container. In
any case you will now be able to connect to the container overSSHusing the
name you gave to the container suffixed with-container:$ ssh test-containerThis works because your~/.ssh/confighas been updated to include a host
definition for the container. This means you can connect usingrsyncor
anything else which works on top ofSSH(e.g. to bootstrap a configuration
management system). When you’re done playing around with the container you can
save your changes with the following command:$ redock commit testThis command will persist the state of the container’s file system in a Docker
image. The next time you run Redock with the same name it will create a
container based on the existing disk image. To kill and delete a running
container you use the following command:$ redock kill testThis will discard all changes made to the file system inside the container
since the last time thatredock commitwas used. The Docker image
associated with a container can be deleted like this:$ redock delete testNaming conventionsIn the examples above the nametestis used. This name is used by Redock to
identify the running container (created withredock start) and any
associated images (created withredock commit). By using multiple names you
can run multiple containers in parallel and you can suspend / resume “long
term” containers.The names accepted by Redock are expected to be of the formrepository:tag(two words separated by a colon):The first part (repositoryin the example) is a top level name space for
Docker images. For example there is a repository calledubuntuthat
contains the official base images. Similarly Redock uses the repositoryredockfor the base image it creates on the first run.The second part (tagin the example) is the name of a specific container
and/or image; I usually just sets it to the host name of the system that
will be running inside the container.If the colon is missing therepositorywill be set to your username (based
on the environment variable$USER).ContactThe latest version of Redock is available onPyPIandGitHub. The API
documentation ishosted on Read The Docs. For bug reports please create an
issue onGitHub. If you have questions, suggestions, etc. feel free to send me
an e-mail atpeter@peterodding.com.LicenseThis software is licensed under theMIT license.© 2013 Peter Odding.