I first heard of Fig when I read about Docker acquiring Orchard, a container hosting service, back in July. Last week I finally got to read a little more about it and it just so happens it is the missing piece of the puzzle in a couple of projects that I am working on right now!
What does Fig do?
The best way I would describe Fig is like Vagrant for Docker containers. If you don't know what Vagrant is, or aren't using it then you are missing out!
Fig lets you bring up and tear down docker containers (single or multiple) with a simple command.
To do this, you express the desired configuration in a YAML file, fig.yml
.
Getting started
On OSX, you'll need to have an accessible Docker environment. The easiest way to do this is with Homebrew and boot2docker
brew install docker
brew install boot2docker
boot2docker init
boot2docker start
export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375
# Install Fig
pip install fig
If you don't have Python and/or pip
installed you may want to install the fig binary
Writing a Fig file for Open vSwitch
Let's say you are doing some integration testing that requires an Open vSwitch container (like I was)...
It's easy with Fig and docker-ovs!
Just write the following in your fig.yml
:
ovs:
image: davetucker/docker-ovs:2.1.2
ports:
- "6640:6640"
command: "/usr/bin/supervisord -n"
privileged: true
then:
fig up -d
# run your tests...
fig stop
One point of note for those familiar with Vagrant is that fig up
will start the container and attach to it hence the usage of fig up -d
in this example to start the containers detached.
Further Reading
This is barely scratching the surface of what Fig is capable of and I would encourage you to check out the examples on the Fig site.
@dave_tucker