Skip to content

Commit

Permalink
Merge pull request wsargent#40 from kxxoling/fig-renamed-to-compose
Browse files Browse the repository at this point in the history
Update the using of fig part to docker-compose
  • Loading branch information
wsargent committed May 9, 2015
2 parents 87be764 + d9ec8e2 commit f56b6e4
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,31 +449,40 @@ ID=$(docker run -d image-name /bin/bash)
(docker export $ID | gzip -c > image.tgz)
gzip -dc image.tgz | docker import - flat-image-name
```


## Tools

* [Fig](#fig)
* [Compose](#compose)
* [Panamax](#panamax)
* [Vessel](#vessel)

### Fig
### Compose

[Fig](http://www.fig.sh/) is a helper app that makes it easier to run multiple docker containers on the same host. I would expect it to be used during dev/qa more than in production.
[Compose](https://github.com/docker/compose) (originally named fig) is a helper app that makes it easier to run multiple docker containers on the same host.
I would expect it to be used during dev/qa more than in production.

Fig works with a ```fig.yml``` file (default name, use ```-f``` to provide a different filename) that defines the containers you wish to use with it. Fig will take its project name from the name of the folder containing your yml configuration but you can override that with the ```-p``` parameter.
Compose works with a YAML file (default name can be ```docker-compose.yml```, use ```-f``` to provide a different filename) that defines the containers you wish to use with it.
Compose will take its project name from the name of the folder containing your yml configuration but you can override that with the ```-p``` parameter.

Once I have my config defined, I can use ```fig up -d``` to run it (the ```-d``` runs it as a background task). This will build (if required) start and link any containers.
Once I have my config defined, I can use ```docker-compose up -d``` to run it (the ```-d``` runs it as a detached task). This will start and link any containers.

You can do everything you do with fig using docker directly but running multiple containers with parameters would require some sort of script if you plan to do it more than once so the yml config of fig and the convenience commands it provides are worth considering.
You can do everything you do with compose using docker directly but running multiple containers with parameters
would require some sort of script if you plan to do it more than once so the yml config of compose
and the convenience commands it provides are worth considering.

Here's an example of setting up a ```fig.yml``` for an app with an apache packaged client container and a tomcat packaged app war:
Here's an example of setting up a ```docker-compose.yml``` for an app with an apache packaged client container and a tomcat packaged app war:

First, here are the two docker commands to run these containers:

```
docker run -p 8080:8080 -v /Users/me/tomcatwork/trial.properties:/usr/share/tomcat6/trial.properties:rw -d me/tcfull
docker run -p 8080:8080 -v /Users/me/tomcatwork/trial.properties:/usr/share/tomcat6/trial.properties:rw -d me/tcfull
docker run -p 80:80 -v /Users/me/dockerwork/localproxy.conf:/etc/apache2/conf-enabled/proxy.conf:rw -d me/afull
```
at this point, I haven't linked the containers - I'm using the proxy.conf to specify the tomcat address.
my fig.yml looks like this:

At this point, I haven't linked the containers - I'm using the proxy.conf to specify the tomcat address.
my docker-compose.yml looks like this:

```
app:
image: me/tcfull
Expand All @@ -486,33 +495,37 @@ web:
ports:
- "80:80"
volumes:
- /Users/me/figwork/proxy.conf:/etc/apache2/conf-enabled/proxy.conf:rw
- /Users/me/figwork/proxy.conf:/etc/apache2/conf-enabled/proxy.conf:rw
links:
- app
```

As you can see it follows the docker commands with the addition of names for the containers and a links section for the web container, linking it to the app container.

As part of that linking process, docker will copy any environment variables defined in the app container over to the web container, define new environment variables for the address the app container is running at and also add an app entry in the etc/hosts file for the web container. I can modify my proxy conf to address ```http://app:8080``` and fig/docker will take care of the rest.

I can then use commands like ```fig stop``` and ```fig rm``` to stop all my containers and remove them.
I can then use commands like ```docker-compose stop``` and ```docker-compose rm``` to stop all my containers and remove them.
NB - docker will [eventually](https://gist.github.com/aanand/9e7ac7185ffd64c1a91a) absorb figs functionality with docker groups and docker up but it looks like they're keeping the yml config so it should be pretty seamless when it happens.


#### Troubleshooting

```fig run``` is a useful command for debugging issues. It allows me to startup a named container (and any it links to) and run a one off command.
```docker-compose run``` is a useful command for debugging issues. It allows me to startup a named container (and any it links to) and run a one off command.

This allows me to do things like ```fig run web env``` which will give me a list of all the environment variables that are available on the web container including the ones generated via the link to app.
This allows me to do things like ```docker-compose run web env``` which will give me a list of all the environment variables that are available on the web container including the ones generated via the link to app.

I can also use ```docker-compose run web bash``` to run my web container interactively the way it has been setup by compose with the link to app so I can debug any issues from the command line.

I can also use ```fig run web bash``` to run my web container interactively the way it has been setup by fig with the link to app so I can debug any issues from the command line.

### Panamax

* [Panamax](http://panamax.io/)

Nice web UI, will let you set up and download multiple docker containers.


### Vessel

* [Vessel](http://awvessel.github.io/)

Vessel automates the setup & use of dockerized development environments
Vessel automates the setup & use of dockerized development environments.

0 comments on commit f56b6e4

Please sign in to comment.