Hacker News new | past | comments | ask | show | jobs | submit login
Fig – Fast, isolated development environments using Docker (github.com/orchardup)
157 points by bcjordan on Feb 28, 2014 | hide | past | favorite | 22 comments



Been using this for a while now for Django development, it's really simplified the way I work.

When I want to start work on a project:

    fig up -d db
    fig up -d redis
    fig up web
One of the main benefits for me using fig/docker is that I only have a single VM on my machine, rather than one for each project. I usually just leave it running in the background.

Combined with docker-osx https://github.com/noplay/docker-osx I don't even need to ssh into my VM to start work.


boot2docker[1] is now the recommended environment for docker on osx, but sadly sharing files is not as easy as it is with docker-osx.

They just integrated nfs support though

[1] https://github.com/boot2docker/boot2docker


Sharing files? With Expandrive you can mount anything you can ssh into. This has been possible on Linux for a long time, Apple is lagging behind there, but Expandrive is a solid 3rd party solution.


There is also sshfs which builds on top of fuse. This is also available for Mac OS X via fuseosx, install through homebrew.


I could never make that work reliably. Could you?


You can collapse the first two to `fig up -d db redis` if you like!


Could you explain more how the VM fits into this workflow?


I imagine it has something to do with the fact that Docker requires Linux, and he's on a Mac.


Fig is awesome, it lets you create a simple fig.yml that can specify multi-container apps. I recently built a fig2coreos adapter that takes the fig.yml as input and outputs the coreos systemd configuration files.

[1] https://github.com/centurylinklabs/fig2coreos

[2] http://www.centurylinklabs.com/building-complex-apps-for-doc...


Can someone explain the differences between Fig, Docker and Vagrant? Without knowing anything about server administration they seem to be doing the same thing, which is obviously wrong since Fig is built on top of Docker.


Vagrant builds virtual machines for you. Like another computer inside of your computer.

Docker can run within a VM, or on your computer if you're not on a Macintosh (Mac's kernel is...for now...not supported). I usually create a Vagrant virtual machine of CoreOS, which works with Docker very nicely.

Docker is a utility which uses "containers". Docker containers are usually used to run one process at a time (apache or mysql or python or grep or anything, really).

You can connect multiple docker containers to create a functioning app. Running one for database and other one for running your code would a simple example.

Fig tries to make the process of making Docker instances work together easy.


The OS X kernel will not be supported.

Docker is built upon features available only in the Linux kernel (LXC, cgroups)


However, Docker is officially supported on OS X through https://github.com/boot2docker/boot2docker


It is officially supported by virtue of boot2docker booting a small Linux kernel in a VM (VirtualBox).


Vagrant is basically a layer on top on virtualbox/vmware that helps you manage VMs more efficiently. It makes it easy to setup your local development enviroments in a vm and replicate the production enviroment for example, instead of installing all the services locally on your machine with homebrew and whatnot and polluting your desktop experience.

Docker is afaik Linux only and uses some kind of container virtualization that makes it possible to run services in a separated virtual enviroment on a per process basis without the need to spin up a full vm with all the overhead. Also these docker containers seem to be portable to different machines pretty easily, making it easy to share enviroments among developers.

Now Fig looks like something to make managing docker containers easier.


I'm still missing a piece of the puzzle. With Vagrant, though heavy weight, I have a completely defined system. If I spin up my production server using the same definition (I use ansible) as my Vagrant config, I guarantee the same outcome. Seems perfect. With Docker, since it relies on the underlying os, it seems I could run into compatibility problems. I understand the "lightweight" aspect, but if I have compatibility problems, that seems not worth the benefit. OR is the issue that those compatibility problems are illusory - Ubuntu 11 will be the same as Ubuntu 12 and CoreOs xx and LinuxZ ZZ? With Docker, what do I lose vs. Vagrant and what do I gain that makes that worthwhile?


with docker, your guest machines run the same kernel as your host, but a different root filesystem and init system. the result is that you can run centOS on docker on Ubuntu, but you'll get centOS with the Ubuntu kernel. So, you lose some flexibility with the kernel of your VM. But a docker container is extremely light weight. it boots in a few hundred milliseconds, and it only costs a small amount more resources to run a service inside docker than if you had just run the service on the host system directly.


assuming you know what a vm is...

vagrant is a manager for vms. it lets you manage vms (by default on virtualbox, but you can use other vm hosts too).

docker is a manager for linux containers. linux containers are linux only and a bit like chroot on steroids - they use the same linux kernel as the host, but with a different file system. so they're like lightweight, linux-only, vms. they're so lightweight that they're being "sold" as containers for single applications (so you then use docker like a package management service, installing postgres, for example, as a docker container - often this can use a separate vm as the host, so that you're not making changes to your main machine, or because you're using a mac).

fig is new to me but seems to be a wrapper around docker that simplifies some things.

the above is a simplification - for example, i'm pretty sure vagrant these days can also manage docker images (linux containers + docker metadata).


Seems like this is pretty comparable to Vagrant using the Docker backend. Anyone have thoughts on pros and cons of each?


[deleted]


The parent didn't say "Vagrant," they said "Vagrant using the Docker backend."


Looks pretty slick. For a recent project, I ended up building a 100 line Makefile, and fig could have covered about 70% of that. That said, Makefile are good to have around


I'm really starting to like Docker now.

Is it possible to have multiple independent web apps talking to one postgres and one redis installation?

I have a VPS with ~10 tiny websites, and it would be total overkill to bundle each app with its own db and caching. How would you reference that same "external" db in a fig configuration?




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: