Merge pull request #835 from aanand/rebrand

Rebrand (pre-RC)
This commit is contained in:
Aanand Prasad 2015-01-20 22:24:21 +00:00
commit 4869fed97f
79 changed files with 314 additions and 698 deletions

2
.gitignore vendored
View File

@ -5,4 +5,4 @@
/dist
/docs/_site
/venv
fig.spec
docker-compose.spec

View File

@ -1,4 +1,4 @@
# Contributing to Fig
# Contributing to Compose
## TL;DR
@ -11,14 +11,14 @@ Pull requests will need:
## Development environment
If you're looking contribute to [Fig](http://www.fig.sh/)
If you're looking contribute to Compose
but you're new to the project or maybe even to Python, here are the steps
that should get you started.
1. Fork [https://github.com/docker/fig](https://github.com/docker/fig) to your username.
1. Clone your forked repository locally `git clone git@github.com:yourusername/fig.git`.
1. Enter the local directory `cd fig`.
1. Set up a development environment by running `python setup.py develop`. This will install the dependencies and set up a symlink from your `fig` executable to the checkout of the repository. When you now run `fig` from anywhere on your machine, it will run your development version of Fig.
1. Fork [https://github.com/docker/compose](https://github.com/docker/compose) to your username.
1. Clone your forked repository locally `git clone git@github.com:yourusername/compose.git`.
1. Enter the local directory `cd compose`.
1. Set up a development environment by running `python setup.py develop`. This will install the dependencies and set up a symlink from your `docker-compose` executable to the checkout of the repository. When you now run `docker-compose` from anywhere on your machine, it will run your development version of Compose.
## Running the test suite
@ -84,7 +84,7 @@ Note that this only works on Mountain Lion, not Mavericks, due to a [bug in PyIn
1. Open pull request that:
- Updates version in `fig/__init__.py`
- Updates version in `compose/__init__.py`
- Updates version in `docs/install.md`
- Adds release notes to `CHANGES.md`
@ -92,7 +92,7 @@ Note that this only works on Mountain Lion, not Mavericks, due to a [bug in PyIn
3. Build Linux version on any Docker host with `script/build-linux` and attach to release
4. Build OS X version on Mountain Lion with `script/build-osx` and attach to release as `fig-Darwin-x86_64` and `fig-Linux-x86_64`.
4. Build OS X version on Mountain Lion with `script/build-osx` and attach to release as `docker-compose-Darwin-x86_64` and `docker-compose-Linux-x86_64`.
5. Publish GitHub release, creating tag

View File

@ -14,4 +14,4 @@ RUN python setup.py install
RUN chown -R user /code/
ENTRYPOINT ["/usr/local/bin/fig"]
ENTRYPOINT ["/usr/local/bin/docker-compose"]

View File

@ -1,5 +1,5 @@
Fig
===
Docker Compose
==============
[![wercker status](https://app.wercker.com/status/d5dbac3907301c3d5ce735e2d5e95a5b/s/master "wercker status")](https://app.wercker.com/project/bykey/d5dbac3907301c3d5ce735e2d5e95a5b)
@ -29,9 +29,7 @@ db:
(No more installing Postgres on your laptop!)
Then type `fig up`, and Fig will start and run your entire app:
![example fig run](https://orchardup.com/static/images/fig-example-large.gif)
Then type `docker-compose up`, and Compose will start and run your entire app.
There are commands to:

View File

@ -1,28 +1,26 @@
# Roadmap
Fig will be incorporated as part of the Docker ecosystem and renamed Docker Compose. The command-line tool and configuration file will get new names, and its documentation will be moved to [docs.docker.com](https://docs.docker.com).
## More than just development environments
Over time we will extend Fig's remit to cover test, staging and production environments. This is not a simple task, and will take many incremental improvements such as:
Over time we will extend Compose's remit to cover test, staging and production environments. This is not a simple task, and will take many incremental improvements such as:
- Figs brute-force “delete and recreate everything” approach is great for dev and testing, but it not sufficient for production environments. You should be able to define a "desired" state that Fig will intelligently converge to.
- Composes brute-force “delete and recreate everything” approach is great for dev and testing, but it not sufficient for production environments. You should be able to define a "desired" state that Compose will intelligently converge to.
- It should be possible to partially modify the config file for different environments (dev/test/staging/prod), passing in e.g. custom ports or volume mount paths. ([#426](https://github.com/docker/fig/issues/426))
- Fig recommend a technique for zero-downtime deploys.
- Compose should recommend a technique for zero-downtime deploys.
## Integration with Swarm
Fig should integrate really well with Swarm so you can take an application you've developed on your laptop and run it on a Swarm cluster.
Compose should integrate really well with Swarm so you can take an application you've developed on your laptop and run it on a Swarm cluster.
## Applications spanning multiple teams
Fig works well for applications that are in a single repository and depend on services that are hosted on Docker Hub. If your application depends on another application within your organisation, Fig doesn't work as well.
Compose works well for applications that are in a single repository and depend on services that are hosted on Docker Hub. If your application depends on another application within your organisation, Compose doesn't work as well.
There are several ideas about how this could work, such as [including external files](https://github.com/docker/fig/issues/318).
## An even better tool for development environments
Fig is a great tool for development environments, but it could be even better. For example:
Compose is a great tool for development environments, but it could be even better. For example:
- [Fig could watch your code and automatically kick off builds when something changes.](https://github.com/docker/fig/issues/184)
- [Compose could watch your code and automatically kick off builds when something changes.](https://github.com/docker/fig/issues/184)
- It should be possible to define hostnames for containers which work from the host machine, e.g. “mywebcontainer.local”. This is needed by apps comprising multiple web services which generate links to one another (e.g. a frontend website and a separate admin webapp)

3
bin/docker-compose Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env python
from compose.cli.main import main
main()

View File

@ -1,3 +0,0 @@
#!/usr/bin/env python
from fig.cli.main import main
main()

View File

@ -43,11 +43,15 @@ class Command(DocoptCommand):
def perform_command(self, options, handler, command_options):
if options['COMMAND'] == 'help':
# Skip looking up the figfile.
# Skip looking up the compose file.
handler(None, command_options)
return
explicit_config_path = options.get('--file') or os.environ.get('FIG_FILE')
if 'FIG_FILE' in os.environ:
log.warn('The FIG_FILE environment variable is deprecated.')
log.warn('Please use COMPOSE_FILE instead.')
explicit_config_path = options.get('--file') or os.environ.get('COMPOSE_FILE') or os.environ.get('FIG_FILE')
project = self.get_project(
self.get_config_path(explicit_config_path),
project_name=options.get('--project-name'),
@ -59,7 +63,7 @@ class Command(DocoptCommand):
client = docker_client()
if verbose:
version_info = six.iteritems(client.version())
log.info("Fig version %s", __version__)
log.info("Compose version %s", __version__)
log.info("Docker base_url: %s", client.base_url)
log.info("Docker version: %s",
", ".join("%s=%s" % item for item in version_info))
@ -72,7 +76,7 @@ class Command(DocoptCommand):
return yaml.safe_load(fh)
except IOError as e:
if e.errno == errno.ENOENT:
raise errors.FigFileNotFound(os.path.basename(e.filename))
raise errors.ComposeFileNotFound(os.path.basename(e.filename))
raise errors.UserError(six.text_type(e))
def get_project(self, config_path, project_name=None, verbose=False):
@ -88,7 +92,11 @@ class Command(DocoptCommand):
def normalize_name(name):
return re.sub(r'[^a-z0-9]', '', name.lower())
project_name = project_name or os.environ.get('FIG_PROJECT_NAME')
if 'FIG_PROJECT_NAME' in os.environ:
log.warn('The FIG_PROJECT_NAME environment variable is deprecated.')
log.warn('Please use COMPOSE_PROJECT_NAME instead.')
project_name = project_name or os.environ.get('COMPOSE_PROJECT_NAME') or os.environ.get('FIG_PROJECT_NAME')
if project_name is not None:
return normalize_name(project_name)
@ -102,13 +110,13 @@ class Command(DocoptCommand):
if file_path:
return os.path.join(self.base_dir, file_path)
if os.path.exists(os.path.join(self.base_dir, 'fig.yaml')):
log.warning("Fig just read the file 'fig.yaml' on startup, rather "
"than 'fig.yml'")
log.warning("Please be aware that fig.yml the expected extension "
if os.path.exists(os.path.join(self.base_dir, 'docker-compose.yaml')):
log.warning("Compose just read the file 'docker-compose.yaml' on startup, rather "
"than 'docker-compose.yml'")
log.warning("Please be aware that .yml is the expected extension "
"in most cases, and using .yaml can cause compatibility "
"issues in future")
return os.path.join(self.base_dir, 'fig.yaml')
return os.path.join(self.base_dir, 'docker-compose.yaml')
return os.path.join(self.base_dir, 'fig.yml')
return os.path.join(self.base_dir, 'docker-compose.yml')

View File

@ -55,8 +55,8 @@ class ConnectionErrorGeneric(UserError):
""" % url)
class FigFileNotFound(UserError):
class ComposeFileNotFound(UserError):
def __init__(self, filename):
super(FigFileNotFound, self).__init__("""
super(ComposeFileNotFound, self).__init__("""
Can't find %s. Are you in the right directory?
""" % filename)

View File

@ -71,13 +71,13 @@ class TopLevelCommand(Command):
"""Fast, isolated development environments using Docker.
Usage:
fig [options] [COMMAND] [ARGS...]
fig -h|--help
docker-compose [options] [COMMAND] [ARGS...]
docker-compose -h|--help
Options:
--verbose Show more output
--version Print version and exit
-f, --file FILE Specify an alternate fig file (default: fig.yml)
-f, --file FILE Specify an alternate compose file (default: docker-compose.yml)
-p, --project-name NAME Specify an alternate project name (default: directory name)
Commands:
@ -99,7 +99,7 @@ class TopLevelCommand(Command):
"""
def docopt_options(self):
options = super(TopLevelCommand, self).docopt_options()
options['version'] = "fig %s" % __version__
options['version'] = "docker-compose %s" % __version__
return options
def build(self, project, options):
@ -107,8 +107,8 @@ class TopLevelCommand(Command):
Build or rebuild services.
Services are built once and then tagged as `project_service`,
e.g. `figtest_db`. If you change a service's `Dockerfile` or the
contents of its build directory, you can run `fig build` to rebuild it.
e.g. `composetest_db`. If you change a service's `Dockerfile` or the
contents of its build directory, you can run `compose build` to rebuild it.
Usage: build [options] [SERVICE...]
@ -261,11 +261,11 @@ class TopLevelCommand(Command):
For example:
$ fig run web python manage.py shell
$ docker-compose run web python manage.py shell
By default, linked services will be started, unless they are already
running. If you do not want to start linked services, use
`fig run --no-deps SERVICE COMMAND [ARGS...]`.
`docker-compose run --no-deps SERVICE COMMAND [ARGS...]`.
Usage: run [options] [-e KEY=VAL...] SERVICE [COMMAND] [ARGS...]
@ -280,7 +280,7 @@ class TopLevelCommand(Command):
--rm Remove container after run. Ignored in detached mode.
--service-ports Run command with the service's ports enabled and mapped
to the host.
-T Disable pseudo-tty allocation. By default `fig run`
-T Disable pseudo-tty allocation. By default `docker-compose run`
allocates a TTY.
"""
service = project.get_service(options['SERVICE'])
@ -352,7 +352,7 @@ class TopLevelCommand(Command):
Numbers are specified in the form `service=num` as arguments.
For example:
$ fig scale web=2 worker=3
$ docker-compose scale web=2 worker=3
Usage: scale [SERVICE=NUM...]
"""
@ -372,7 +372,7 @@ class TopLevelCommand(Command):
'Service "%s" cannot be scaled because it specifies a port '
'on the host. If multiple containers for this service were '
'created, the port would clash.\n\nRemove the ":" from the '
'port definition in fig.yml so Docker can choose a random '
'port definition in docker-compose.yml so Docker can choose a random '
'port for each container.' % service_name)
def start(self, project, options):
@ -387,7 +387,7 @@ class TopLevelCommand(Command):
"""
Stop running containers without removing them.
They can be started again with `fig start`.
They can be started again with `docker-compose start`.
Usage: stop [SERVICE...]
"""
@ -405,14 +405,14 @@ class TopLevelCommand(Command):
"""
Build, (re)create, start and attach to containers for a service.
By default, `fig up` will aggregate the output of each container, and
when it exits, all containers will be stopped. If you run `fig up -d`,
By default, `docker-compose up` will aggregate the output of each container, and
when it exits, all containers will be stopped. If you run `docker-compose up -d`,
it'll start the containers in the background and leave them running.
If there are existing containers for a service, `fig up` will stop
If there are existing containers for a service, `docker-compose up` will stop
and recreate them (preserving mounted volumes with volumes-from),
so that changes in `fig.yml` are picked up. If you do not want existing
containers to be recreated, `fig up --no-recreate` will re-use existing
so that changes in `docker-compose.yml` are picked up. If you do not want existing
containers to be recreated, `docker-compose up --no-recreate` will re-use existing
containers.
Usage: up [options] [SERVICE...]

View File

@ -67,7 +67,7 @@ class Project(object):
dicts = []
for service_name, service in list(config.items()):
if not isinstance(service, dict):
raise ConfigurationError('Service "%s" doesn\'t have any configuration options. All top level keys in your fig.yml must map to a dictionary of configuration options.' % service_name)
raise ConfigurationError('Service "%s" doesn\'t have any configuration options. All top level keys in your docker-compose.yml must map to a dictionary of configuration options.' % service_name)
service['name'] = service_name
dicts.append(service)
return cls.from_dicts(name, dicts, client)

View File

@ -127,7 +127,7 @@ class Service(object):
return project == self.project and name == self.name
def get_container(self, number=1):
"""Return a :class:`fig.container.Container` for this service. The
"""Return a :class:`compose.container.Container` for this service. The
container must be active, and match `number`.
"""
for container in self.client.containers():

View File

@ -1 +0,0 @@
/_site

View File

@ -1 +0,0 @@
www.fig.sh

View File

@ -1,10 +0,0 @@
FROM ubuntu:13.10
RUN apt-get -qq update && apt-get install -y ruby1.8 bundler python
RUN locale-gen en_US.UTF-8
ADD Gemfile /code/
ADD Gemfile.lock /code/
WORKDIR /code
RUN bundle install
ADD . /code
EXPOSE 4000
CMD bundle exec jekyll build

View File

@ -1,3 +0,0 @@
source 'https://rubygems.org'
gem 'github-pages'

View File

@ -1,62 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
RedCloth (4.2.9)
blankslate (2.1.2.4)
classifier (1.3.3)
fast-stemmer (>= 1.0.0)
colorator (0.1)
commander (4.1.5)
highline (~> 1.6.11)
fast-stemmer (1.0.2)
ffi (1.9.3)
github-pages (12)
RedCloth (= 4.2.9)
jekyll (= 1.4.2)
kramdown (= 1.2.0)
liquid (= 2.5.4)
maruku (= 0.7.0)
rdiscount (= 2.1.7)
redcarpet (= 2.3.0)
highline (1.6.20)
jekyll (1.4.2)
classifier (~> 1.3)
colorator (~> 0.1)
commander (~> 4.1.3)
liquid (~> 2.5.2)
listen (~> 1.3)
maruku (~> 0.7.0)
pygments.rb (~> 0.5.0)
redcarpet (~> 2.3.0)
safe_yaml (~> 0.9.7)
toml (~> 0.1.0)
kramdown (1.2.0)
liquid (2.5.4)
listen (1.3.1)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
rb-kqueue (>= 0.2)
maruku (0.7.0)
parslet (1.5.0)
blankslate (~> 2.0)
posix-spawn (0.3.8)
pygments.rb (0.5.4)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0)
rb-fsevent (0.9.4)
rb-inotify (0.9.3)
ffi (>= 0.5.0)
rb-kqueue (0.2.0)
ffi (>= 0.5.0)
rdiscount (2.1.7)
redcarpet (2.3.0)
safe_yaml (0.9.7)
toml (0.1.0)
parslet (~> 1.5.0)
yajl-ruby (1.1.0)
PLATFORMS
ruby
DEPENDENCIES
github-pages

View File

@ -1,3 +0,0 @@
markdown: redcarpet
encoding: utf-8

View File

@ -1,73 +0,0 @@
<!DOCTYPE html>
<html lang="en-gb">
<head>
<meta charset="utf-8">
<title>{{ page.title }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href='http://fonts.googleapis.com/css?family=Lilita+One|Lato:300,400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/fig.css?{{ site.time | date:'%Y%m%d%U%H%N%S' }}">
<link rel="canonical" href="http://www.fig.sh{% if page.url =="/index.html" %}/{% else %}{{ page.url }}{% endif %}">
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon">
<link rel="icon" href="img/favicon.ico" type="image/x-icon">
</head>
<body>
<div class="container">
<div class="logo mobile-logo">
<a href="index.html">
<img src="img/logo.png">
Fig
</a>
</div>
<div class="content">{{ content }}</div>
<div class="sidebar">
<h1 class="logo">
<a href="index.html">
<img src="img/logo.png">
Fig
</a>
</h1>
<ul class="nav">
<li><a href="index.html">Home</a></li>
<li><a href="install.html">Install</a></li>
<li><a href="rails.html">Get started with Rails</a></li>
<li><a href="django.html">Get started with Django</a></li>
<li><a href="wordpress.html">Get started with Wordpress</a></li>
</ul>
<ul class="nav">
<li>Reference:</li>
<ul>
<li><a href="yml.html">fig.yml</a></li>
<li><a href="cli.html">Commands</a></li>
<li><a href="env.html">Environment variables</a></li>
</ul>
</ul>
<ul class="nav">
<li><a href="https://github.com/docker/fig">Fig on GitHub</a></li>
<li><a href="http://webchat.freenode.net/?channels=%23docker-fig&uio=d4">#docker-fig on Freenode</a></li>
</ul>
<p>Fig is a project from <a href="https://www.docker.com">Docker</a>.</p>
<div class="badges">
<iframe src="http://ghbtns.com/github-btn.html?user=docker&amp;repo=fig&amp;type=watch&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100" height="20"></iframe>
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.fig.sh/">Tweet</a>
</div>
</div>
</div>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-43996733-3', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>

View File

@ -1,6 +1,6 @@
---
layout: default
title: Fig CLI reference
title: Compose CLI reference
---
CLI reference
@ -8,7 +8,7 @@ CLI reference
Most commands are run against one or more services. If the service is omitted, it will apply to all services.
Run `fig [COMMAND] --help` for full usage.
Run `docker-compose [COMMAND] --help` for full usage.
## Options
@ -22,7 +22,7 @@ Run `fig [COMMAND] --help` for full usage.
### -f, --file FILE
Specify an alternate fig file (default: fig.yml)
Specify an alternate compose file (default: docker-compose.yml)
### -p, --project-name NAME
@ -34,7 +34,7 @@ Run `fig [COMMAND] --help` for full usage.
Build or rebuild services.
Services are built once and then tagged as `project_service`, e.g. `figtest_db`. If you change a service's `Dockerfile` or the contents of its build directory, you can run `fig build` to rebuild it.
Services are built once and then tagged as `project_service`, e.g. `composetest_db`. If you change a service's `Dockerfile` or the contents of its build directory, you can run `docker-compose build` to rebuild it.
### help
@ -44,7 +44,7 @@ Get help on a command.
Force stop running containers by sending a `SIGKILL` signal. Optionally the signal can be passed, for example:
$ fig kill -s SIGINT
$ docker-compose kill -s SIGINT
### logs
@ -73,22 +73,22 @@ Run a one-off command on a service.
For example:
$ fig run web python manage.py shell
$ docker-compose run web python manage.py shell
By default, linked services will be started, unless they are already running.
One-off commands are started in new containers with the same config as a normal container for that service, so volumes, links, etc will all be created as expected. The only thing different to a normal container is the command will be overridden with the one specified and by default no ports will be created in case they collide.
One-off commands are started in new containers with the same configuration as a normal container for that service, so volumes, links, etc will all be created as expected. The only thing different to a normal container is the command will be overridden with the one specified and by default no ports will be created in case they collide.
Links are also created between one-off commands and the other containers for that service so you can do stuff like this:
$ fig run db psql -h db -U docker
$ docker-compose run db psql -h db -U docker
If you do not want linked containers to be started when running the one-off command, specify the `--no-deps` flag:
$ fig run --no-deps web python manage.py shell
$ docker-compose run --no-deps web python manage.py shell
If you want the service's ports to be created and mapped to the host, specify the `--service-ports` flag:
$ fig run --service-ports web python manage.py shell
$ docker-compose run --service-ports web python manage.py shell
### scale
@ -97,7 +97,7 @@ Set number of containers to run for a service.
Numbers are specified in the form `service=num` as arguments.
For example:
$ fig scale web=2 worker=3
$ docker-compose scale web=2 worker=3
### start
@ -105,7 +105,7 @@ Start existing containers for a service.
### stop
Stop running containers without removing them. They can be started again with `fig start`.
Stop running containers without removing them. They can be started again with `docker-compose start`.
### up
@ -113,26 +113,26 @@ Build, (re)create, start and attach to containers for a service.
Linked services will be started, unless they are already running.
By default, `fig up` will aggregate the output of each container, and when it exits, all containers will be stopped. If you run `fig up -d`, it'll start the containers in the background and leave them running.
By default, `docker-compose up` will aggregate the output of each container, and when it exits, all containers will be stopped. If you run `docker-compose up -d`, it'll start the containers in the background and leave them running.
By default if there are existing containers for a service, `fig up` will stop and recreate them (preserving mounted volumes with [volumes-from]), so that changes in `fig.yml` are picked up. If you do no want containers to be stopped and recreated, use `fig up --no-recreate`. This will still start any stopped containers, if needed.
By default if there are existing containers for a service, `docker-compose up` will stop and recreate them (preserving mounted volumes with [volumes-from]), so that changes in `docker-compose.yml` are picked up. If you do no want containers to be stopped and recreated, use `docker-compose up --no-recreate`. This will still start any stopped containers, if needed.
[volumes-from]: http://docs.docker.io/en/latest/use/working_with_volumes/
## Environment Variables
Several environment variables can be used to configure Fig's behaviour.
Several environment variables can be used to configure Compose's behaviour.
Variables starting with `DOCKER_` are the same as those used to configure the Docker command-line client. If you're using boot2docker, `$(boot2docker shellinit)` will set them to their correct values.
### FIG\_PROJECT\_NAME
Set the project name, which is prepended to the name of every container started by Fig. Defaults to the `basename` of the current working directory.
Set the project name, which is prepended to the name of every container started by Compose. Defaults to the `basename` of the current working directory.
### FIG\_FILE
Set the path to the `fig.yml` to use. Defaults to `fig.yml` in the current working directory.
Set the path to the `docker-compose.yml` to use. Defaults to `docker-compose.yml` in the current working directory.
### DOCKER\_HOST

View File

@ -6,7 +6,7 @@ title: Command Completion
Command Completion
==================
Fig comes with [command completion](http://en.wikipedia.org/wiki/Command-line_completion)
Compose comes with [command completion](http://en.wikipedia.org/wiki/Command-line_completion)
for the bash shell.
Installing Command Completion
@ -17,7 +17,7 @@ On a Mac, install with `brew install bash-completion`
Place the completion script in `/etc/bash_completion.d/` (`/usr/local/etc/bash_completion.d/` on a Mac), using e.g.
curl -L https://raw.githubusercontent.com/docker/fig/master/contrib/completion/bash/fig > /etc/bash_completion.d/fig
curl -L https://raw.githubusercontent.com/docker/docker-compose/master/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose
Completion will be available upon next login.
@ -25,9 +25,9 @@ Available completions
---------------------
Depending on what you typed on the command line so far, it will complete
- available fig commands
- available docker-compose commands
- options that are available for a particular command
- service names that make sense in a given context (e.g. services with running or stopped instances or services based on images vs. services based on Dockerfiles). For `fig scale`, completed service names will automatically have "=" appended.
- arguments for selected options, e.g. `fig kill -s` will complete some signals like SIGHUP and SIGUSR1.
- service names that make sense in a given context (e.g. services with running or stopped instances or services based on images vs. services based on Dockerfiles). For `docker-compose scale`, completed service names will automatically have "=" appended.
- arguments for selected options, e.g. `docker-compose kill -s` will complete some signals like SIGHUP and SIGUSR1.
Enjoy working with fig faster and with less typos!
Enjoy working with Compose faster and with less typos!

File diff suppressed because one or more lines are too long

View File

@ -1,187 +0,0 @@
body {
padding-top: 20px;
padding-bottom: 60px;
font-family: 'Lato', sans-serif;
font-weight: 300;
font-size: 18px;
color: #362;
}
h1, h2, h3, h4, h5, h6 {
font-family: 'Lato', sans-serif;
font-weight: 400;
color: #25594D;
}
h2, h3, h4, h5, h6 {
margin-top: 1.5em;
}
p {
margin: 20px 0;
}
a, a:hover, a:visited {
color: #4D9900;
text-decoration: underline;
}
pre, code {
border: none;
background: #D5E1B4;
}
code, pre code {
color: #484F40;
}
pre {
border-bottom: 2px solid #bec9a1;
font-size: 14px;
}
code {
font-size: 0.84em;
}
pre code {
background: none;
}
img {
max-width: 100%;
}
.container {
margin-left: 0;
}
.logo {
font-family: 'Lilita One', sans-serif;
font-size: 64px;
margin: 20px 0 40px 0;
}
.logo a {
color: #a41211;
text-decoration: none;
}
.logo img {
width: 60px;
vertical-align: -8px;
}
.mobile-logo {
text-align: center;
}
.sidebar {
font-size: 15px;
color: #777;
}
.sidebar a {
color: #a41211;
}
.sidebar p {
margin: 10px 0;
}
@media (max-width: 767px) {
.sidebar {
text-align: center;
margin-top: 40px;
}
.sidebar .logo {
display: none;
}
}
@media (min-width: 768px) {
.mobile-logo {
display: none;
}
.logo {
margin-top: 30px;
margin-bottom: 30px;
}
.content h1 {
margin: 60px 0 55px 0;
}
.sidebar {
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 280px;
overflow-y: auto;
padding-left: 40px;
padding-right: 10px;
border-right: 1px solid #ccc;
}
.content {
margin-left: 320px;
max-width: 650px;
}
}
.nav {
margin: 15px 0;
}
.nav li a {
display: block;
padding: 5px 0;
line-height: 1.2;
text-decoration: none;
}
.nav li a:hover, .nav li a:focus {
text-decoration: underline;
background: none;
}
.nav ul {
padding-left: 20px;
list-style: none;
}
.badges {
margin: 40px 0;
}
a.btn {
background: #25594D;
color: white;
text-transform: uppercase;
text-decoration: none;
}
a.btn:hover {
color: white;
}
.strapline {
font-size: 30px;
}
@media (min-width: 768px) {
.strapline {
font-size: 40px;
display: block;
line-height: 1.2;
margin-top: 25px;
margin-bottom: 35px;
}
}
strong {
font-weight: 700;
}

View File

@ -1,12 +1,12 @@
---
layout: default
title: Getting started with Fig and Django
title: Getting started with Compose and Django
---
Getting started with Fig and Django
Getting started with Compose and Django
===================================
Let's use Fig to set up and run a Django/PostgreSQL app. Before starting, you'll need to have [Fig installed](install.html).
Let's use Compose to set up and run a Django/PostgreSQL app. Before starting, you'll need to have [Compose installed](install.html).
Let's set up the three files that'll get us started. First, our app is going to be running inside a Docker container which contains all of its dependencies. We can define what goes inside that Docker container using a file called `Dockerfile`. It'll contain this to start with:
@ -25,7 +25,7 @@ Second, we define our Python dependencies in a file called `requirements.txt`:
Django
psycopg2
Simple enough. Finally, this is all tied together with a file called `fig.yml`. It describes the services that our app comprises of (a web server and database), what Docker images they use, how they link together, what volumes will be mounted inside the containers and what ports they expose.
Simple enough. Finally, this is all tied together with a file called `docker-compose.yml`. It describes the services that our app comprises of (a web server and database), what Docker images they use, how they link together, what volumes will be mounted inside the containers and what ports they expose.
db:
image: postgres
@ -39,20 +39,20 @@ Simple enough. Finally, this is all tied together with a file called `fig.yml`.
links:
- db
See the [`fig.yml` reference](yml.html) for more information on how it works.
See the [`docker-compose.yml` reference](yml.html) for more information on how it works.
We can now start a Django project using `fig run`:
We can now start a Django project using `docker-compose run`:
$ fig run web django-admin.py startproject figexample .
$ docker-compose run web django-admin.py startproject composeexample .
First, Fig will build an image for the `web` service using the `Dockerfile`. It will then run `django-admin.py startproject figexample .` inside a container using that image.
First, Compose will build an image for the `web` service using the `Dockerfile`. It will then run `django-admin.py startproject composeexample .` inside a container using that image.
This will generate a Django app inside the current directory:
$ ls
Dockerfile fig.yml figexample manage.py requirements.txt
Dockerfile docker-compose.yml composeexample manage.py requirements.txt
First thing we need to do is set up the database connection. Replace the `DATABASES = ...` definition in `figexample/settings.py` to read:
First thing we need to do is set up the database connection. Replace the `DATABASES = ...` definition in `composeexample/settings.py` to read:
DATABASES = {
'default': {
@ -66,7 +66,7 @@ First thing we need to do is set up the database connection. Replace the `DATABA
These settings are determined by the [postgres](https://registry.hub.docker.com/_/postgres/) Docker image we are using.
Then, run `fig up`:
Then, run `docker-compose up`:
Recreating myapp_db_1...
Recreating myapp_web_1...
@ -79,13 +79,13 @@ Then, run `fig up`:
myapp_web_1 |
myapp_web_1 | 0 errors found
myapp_web_1 | January 27, 2014 - 12:12:40
myapp_web_1 | Django version 1.6.1, using settings 'figexample.settings'
myapp_web_1 | Django version 1.6.1, using settings 'composeexample.settings'
myapp_web_1 | Starting development server at http://0.0.0.0:8000/
myapp_web_1 | Quit the server with CONTROL-C.
And your Django app should be running at port 8000 on your docker daemon (if you're using boot2docker, `boot2docker ip` will tell you its address).
You can also run management commands with Docker. To set up your database, for example, run `fig up` and in another terminal run:
You can also run management commands with Docker. To set up your database, for example, run `docker-compose up` and in another terminal run:
$ fig run web python manage.py syncdb
$ docker-compose run web python manage.py syncdb

View File

@ -1,16 +1,16 @@
---
layout: default
title: Fig environment variables reference
title: Compose environment variables reference
---
Environment variables reference
===============================
**Note:** Environment variables are no longer the recommended method for connecting to linked services. Instead, you should use the link name (by default, the name of the linked service) as the hostname to connect to. See the [fig.yml documentation](yml.html#links) for details.
**Note:** Environment variables are no longer the recommended method for connecting to linked services. Instead, you should use the link name (by default, the name of the linked service) as the hostname to connect to. See the [docker-compose.yml documentation](yml.html#links) for details.
Fig uses [Docker links] to expose services' containers to one another. Each linked container injects a set of environment variables, each of which begins with the uppercase name of the container.
Compose uses [Docker links] to expose services' containers to one another. Each linked container injects a set of environment variables, each of which begins with the uppercase name of the container.
To see what environment variables are available to a service, run `fig run SERVICE env`.
To see what environment variables are available to a service, run `docker-compose run SERVICE env`.
<b><i>name</i>\_PORT</b><br>
Full URL, e.g. `DB_PORT=tcp://172.17.0.5:5432`

View File

@ -1,8 +0,0 @@
jekyll:
build: .
ports:
- "4000:4000"
volumes:
- .:/code
environment:
- LANG=en_US.UTF-8

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

View File

@ -1,10 +1,8 @@
---
layout: default
title: Fig | Fast, isolated development environments using Docker
title: Compose: Multi-container orchestration for Docker
---
<strong class="strapline">Fast, isolated development environments using Docker.</strong>
Define your app's environment with a `Dockerfile` so it can be reproduced anywhere:
FROM python:2.7
@ -12,7 +10,7 @@ Define your app's environment with a `Dockerfile` so it can be reproduced anywhe
WORKDIR /code
RUN pip install -r requirements.txt
Define the services that make up your app in `fig.yml` so they can be run together in an isolated environment:
Define the services that make up your app in `docker-compose.yml` so they can be run together in an isolated environment:
```yaml
web:
@ -28,9 +26,7 @@ db:
(No more installing Postgres on your laptop!)
Then type `fig up`, and Fig will start and run your entire app:
![example fig run](https://orchardup.com/static/images/fig-example-large.gif)
Then type `docker-compose up`, and Compose will start and run your entire app.
There are commands to:
@ -43,14 +39,14 @@ There are commands to:
Quick start
-----------
Let's get a basic Python web app running on Fig. It assumes a little knowledge of Python, but the concepts should be clear if you're not familiar with it.
Let's get a basic Python web app running on Compose. It assumes a little knowledge of Python, but the concepts should be clear if you're not familiar with it.
First, [install Docker and Fig](install.html).
First, [install Docker and Compose](install.html).
You'll want to make a directory for the project:
$ mkdir figtest
$ cd figtest
$ mkdir composetest
$ cd composetest
Inside this directory, create `app.py`, a simple web app that uses the Flask framework and increments a value in Redis:
@ -84,7 +80,7 @@ Next, we want to create a Docker image containing all of our app's dependencies.
This tells Docker to install Python, our code and our Python dependencies inside a Docker image. For more information on how to write Dockerfiles, see the [Docker user guide](https://docs.docker.com/userguide/dockerimages/#building-an-image-from-a-dockerfile) and the [Dockerfile reference](http://docs.docker.com/reference/builder/).
We then define a set of services using `fig.yml`:
We then define a set of services using `docker-compose.yml`:
web:
build: .
@ -103,38 +99,38 @@ This defines two services:
- `web`, which is built from `Dockerfile` in the current directory. It also says to run the command `python app.py` inside the image, forward the exposed port 5000 on the container to port 5000 on the host machine, connect up the Redis service, and mount the current directory inside the container so we can work on code without having to rebuild the image.
- `redis`, which uses the public image [redis](https://registry.hub.docker.com/_/redis/).
Now if we run `fig up`, it'll pull a Redis image, build an image for our own code, and start everything up:
Now if we run `docker-compose up`, it'll pull a Redis image, build an image for our own code, and start everything up:
$ fig up
$ docker-compose up
Pulling image redis...
Building web...
Starting figtest_redis_1...
Starting figtest_web_1...
Starting composetest_redis_1...
Starting composetest_web_1...
redis_1 | [8] 02 Jan 18:43:35.576 # Server started, Redis version 2.8.3
web_1 | * Running on http://0.0.0.0:5000/
The web app should now be listening on port 5000 on your docker daemon (if you're using boot2docker, `boot2docker ip` will tell you its address).
If you want to run your services in the background, you can pass the `-d` flag to `fig up` and use `fig ps` to see what is currently running:
If you want to run your services in the background, you can pass the `-d` flag to `docker-compose up` and use `docker-compose ps` to see what is currently running:
$ fig up -d
Starting figtest_redis_1...
Starting figtest_web_1...
$ fig ps
$ docker-compose up -d
Starting composetest_redis_1...
Starting composetest_web_1...
$ docker-compose ps
Name Command State Ports
-------------------------------------------------------------------
figtest_redis_1 /usr/local/bin/run Up
figtest_web_1 /bin/sh -c python app.py Up 5000->5000/tcp
composetest_redis_1 /usr/local/bin/run Up
composetest_web_1 /bin/sh -c python app.py Up 5000->5000/tcp
`fig run` allows you to run one-off commands for your services. For example, to see what environment variables are available to the `web` service:
`docker-compose run` allows you to run one-off commands for your services. For example, to see what environment variables are available to the `web` service:
$ fig run web env
$ docker-compose run web env
See `fig --help` other commands that are available.
See `docker-compose --help` other commands that are available.
If you started Fig with `fig up -d`, you'll probably want to stop your services once you've finished with them:
If you started Compose with `docker-compose up -d`, you'll probably want to stop your services once you've finished with them:
$ fig stop
$ docker-compose stop
That's more-or-less how Fig works. See the reference section below for full details on the commands, configuration file and environment variables. If you have any thoughts or suggestions, [open an issue on GitHub](https://github.com/docker/fig).
That's more-or-less how Compose works. See the reference section below for full details on the commands, configuration file and environment variables. If you have any thoughts or suggestions, [open an issue on GitHub](https://github.com/docker/docker-compose).

View File

@ -1,14 +1,14 @@
---
layout: default
title: Installing Fig
title: Installing Compose
---
Installing Fig
Installing Compose
==============
First, install Docker version 1.3 or greater.
If you're on OS X, you can use the [OS X installer](https://docs.docker.com/installation/mac/) to install both Docker and boot2docker. Once boot2docker is running, set the environment variables that'll configure Docker and Fig to talk to it:
If you're on OS X, you can use the [OS X installer](https://docs.docker.com/installation/mac/) to install both Docker and boot2docker. Once boot2docker is running, set the environment variables that'll configure Docker and Compose to talk to it:
$(boot2docker shellinit)
@ -16,14 +16,14 @@ To persist the environment variables across shell sessions, you can add that lin
There are also guides for [Ubuntu](https://docs.docker.com/installation/ubuntulinux/) and [other platforms](https://docs.docker.com/installation/) in Dockers documentation.
Next, install Fig:
Next, install Compose:
curl -L https://github.com/docker/fig/releases/download/1.0.1/fig-`uname -s`-`uname -m` > /usr/local/bin/fig; chmod +x /usr/local/bin/fig
curl -L https://github.com/docker/docker-compose/releases/download/1.0.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose; chmod +x /usr/local/bin/docker-compose
Optionally, install [command completion](completion.html) for the bash shell.
Releases are available for OS X and 64-bit Linux. Fig is also available as a Python package if you're on another platform (or if you prefer that sort of thing):
Releases are available for OS X and 64-bit Linux. Compose is also available as a Python package if you're on another platform (or if you prefer that sort of thing):
$ sudo pip install -U fig
$ sudo pip install -U docker-compose
That should be all you need! Run `fig --version` to see if it worked.
That should be all you need! Run `docker-compose --version` to see if it worked.

View File

@ -1,12 +1,12 @@
---
layout: default
title: Getting started with Fig and Rails
title: Getting started with Compose and Rails
---
Getting started with Fig and Rails
Getting started with Compose and Rails
==================================
We're going to use Fig to set up and run a Rails/PostgreSQL app. Before starting, you'll need to have [Fig installed](install.html).
We're going to use Compose to set up and run a Rails/PostgreSQL app. Before starting, you'll need to have [Compose installed](install.html).
Let's set up the three files that'll get us started. First, our app is going to be running inside a Docker container which contains all of its dependencies. We can define what goes inside that Docker container using a file called `Dockerfile`. It'll contain this to start with:
@ -25,7 +25,7 @@ Next, we have a bootstrap `Gemfile` which just loads Rails. It'll be overwritten
source 'https://rubygems.org'
gem 'rails', '4.0.2'
Finally, `fig.yml` is where the magic happens. It describes what services our app comprises (a database and a web app), how to get each one's Docker image (the database just runs on a pre-made PostgreSQL image, and the web app is built from the current directory), and the configuration we need to link them together and expose the web app's port.
Finally, `docker-compose.yml` is where the magic happens. It describes what services our app comprises (a database and a web app), how to get each one's Docker image (the database just runs on a pre-made PostgreSQL image, and the web app is built from the current directory), and the configuration we need to link them together and expose the web app's port.
db:
image: postgres
@ -41,14 +41,14 @@ Finally, `fig.yml` is where the magic happens. It describes what services our ap
links:
- db
With those files in place, we can now generate the Rails skeleton app using `fig run`:
With those files in place, we can now generate the Rails skeleton app using `docker-compose run`:
$ fig run web rails new . --force --database=postgresql --skip-bundle
$ docker-compose run web rails new . --force --database=postgresql --skip-bundle
First, Fig will build the image for the `web` service using the `Dockerfile`. Then it'll run `rails new` inside a new container, using that image. Once it's done, you should have a fresh app generated:
First, Compose will build the image for the `web` service using the `Dockerfile`. Then it'll run `rails new` inside a new container, using that image. Once it's done, you should have a fresh app generated:
$ ls
Dockerfile app fig.yml tmp
Dockerfile app docker-compose.yml tmp
Gemfile bin lib vendor
Gemfile.lock config log
README.rdoc config.ru public
@ -60,7 +60,7 @@ Uncomment the line in your new `Gemfile` which loads `therubyracer`, so we've go
Now that we've got a new `Gemfile`, we need to build the image again. (This, and changes to the Dockerfile itself, should be the only times you'll need to rebuild).
$ fig build
$ docker-compose build
The app is now bootable, but we're not quite there yet. By default, Rails expects a database to be running on `localhost` - we need to point it at the `db` container instead. We also need to change the database and username to align with the defaults set by the `postgres` image.
@ -81,7 +81,7 @@ Open up your newly-generated `database.yml`. Replace its contents with the follo
We can now boot the app.
$ fig up
$ docker-compose up
If all's well, you should see some PostgreSQL output, and then—after a few seconds—the familiar refrain:
@ -91,8 +91,6 @@ If all's well, you should see some PostgreSQL output, and then—after a few sec
Finally, we just need to create the database. In another terminal, run:
$ fig run web rake db:create
$ docker-compose run web rake db:create
And we're rolling—your app should now be running on port 3000 on your docker daemon (if you're using boot2docker, `boot2docker ip` will tell you its address).
![Screenshot of Rails' stock index.html](https://orchardup.com/static/images/fig-rails-screenshot.png)

View File

@ -1,12 +1,12 @@
---
layout: default
title: Getting started with Fig and Wordpress
title: Getting started with Compose and Wordpress
---
Getting started with Fig and Wordpress
Getting started with Compose and Wordpress
======================================
Fig makes it nice and easy to run Wordpress in an isolated environment. [Install Fig](install.html), then download Wordpress into the current directory:
Compose makes it nice and easy to run Wordpress in an isolated environment. [Install Compose](install.html), then download Wordpress into the current directory:
$ curl https://wordpress.org/latest.tar.gz | tar -xvzf -
@ -19,7 +19,7 @@ ADD . /code
This instructs Docker on how to build an image that contains PHP and Wordpress. For more information on how to write Dockerfiles, see the [Docker user guide](https://docs.docker.com/userguide/dockerimages/#building-an-image-from-a-dockerfile) and the [Dockerfile reference](http://docs.docker.com/reference/builder/).
Next up, `fig.yml` starts our web service and a separate MySQL instance:
Next up, `docker-compose.yml` starts our web service and a separate MySQL instance:
```
web:
@ -88,4 +88,4 @@ if(file_exists($root.$path))
}else include_once 'index.php';
```
With those four files in place, run `fig up` inside your Wordpress directory and it'll pull and build the images we need, and then start the web and database containers. You'll then be able to visit Wordpress at port 8000 on your docker daemon (if you're using boot2docker, `boot2docker ip` will tell you its address).
With those four files in place, run `docker-compose up` inside your Wordpress directory and it'll pull and build the images we need, and then start the web and database containers. You'll then be able to visit Wordpress at port 8000 on your docker daemon (if you're using boot2docker, `boot2docker ip` will tell you its address).

View File

@ -1,18 +1,18 @@
---
layout: default
title: fig.yml reference
title: docker-compose.yml reference
---
fig.yml reference
docker-compose.yml reference
=================
Each service defined in `fig.yml` must specify exactly one of `image` or `build`. Other keys are optional, and are analogous to their `docker run` command-line counterparts.
Each service defined in `docker-compose.yml` must specify exactly one of `image` or `build`. Other keys are optional, and are analogous to their `docker run` command-line counterparts.
As with `docker run`, options specified in the Dockerfile (e.g. `CMD`, `EXPOSE`, `VOLUME`, `ENV`) are respected by default - you don't need to specify them again in `fig.yml`.
As with `docker run`, options specified in the Dockerfile (e.g. `CMD`, `EXPOSE`, `VOLUME`, `ENV`) are respected by default - you don't need to specify them again in `docker-compose.yml`.
###image
Tag or partial image ID. Can be local or remote - Fig will attempt to pull if it doesn't exist locally.
Tag or partial image ID. Can be local or remote - Compose will attempt to pull if it doesn't exist locally.
```
image: ubuntu
@ -22,7 +22,7 @@ image: a4bc65fd
### build
Path to a directory containing a Dockerfile. Fig will build and tag it with a generated name, and use that image thereafter.
Path to a directory containing a Dockerfile. Compose will build and tag it with a generated name, and use that image thereafter.
```
build: /path/to/build/dir
@ -60,7 +60,7 @@ Environment variables will also be created - see the [environment variable refer
### external_links
Link to containers started outside this `fig.yml` or even outside of fig, especially for containers that provide shared or common services.
Link to containers started outside this `docker-compose.yml` or even outside of Compose, especially for containers that provide shared or common services.
`external_links` follow semantics similar to `links` when specifying both the container name and the link alias (`CONTAINER:ALIAS`).
```
@ -120,7 +120,7 @@ volumes_from:
Add environment variables. You can use either an array or a dictionary.
Environment variables with only a key are resolved to their values on the machine Fig is running on, which can be helpful for secret or host-specific values.
Environment variables with only a key are resolved to their values on the machine Compose is running on, which can be helpful for secret or host-specific values.
```
environment:

View File

@ -1,5 +0,0 @@
#!/bin/bash
set -ex
pushd docs
fig run --rm jekyll jekyll build
popd

View File

@ -2,7 +2,7 @@
set -ex
mkdir -p `pwd`/dist
chmod 777 `pwd`/dist
docker build -t fig .
docker run -u user -v `pwd`/dist:/code/dist --rm --entrypoint pyinstaller fig -F bin/fig
mv dist/fig dist/fig-Linux-x86_64
docker run -u user -v `pwd`/dist:/code/dist --rm --entrypoint dist/fig-Linux-x86_64 fig --version
docker build -t docker-compose .
docker run -u user -v `pwd`/dist:/code/dist --rm --entrypoint pyinstaller docker-compose -F bin/docker-compose
mv dist/docker-compose dist/docker-compose-Linux-x86_64
docker run -u user -v `pwd`/dist:/code/dist --rm --entrypoint dist/docker-compose-Linux-x86_64 docker-compose --version

View File

@ -5,6 +5,6 @@ virtualenv venv
venv/bin/pip install -r requirements.txt
venv/bin/pip install -r requirements-dev.txt
venv/bin/pip install .
venv/bin/pyinstaller -F bin/fig
mv dist/fig dist/fig-Darwin-x86_64
dist/fig-Darwin-x86_64 --version
venv/bin/pyinstaller -F bin/docker-compose
mv dist/docker-compose dist/docker-compose-Darwin-x86_64
dist/docker-compose-Darwin-x86_64 --version

View File

@ -1,3 +1,3 @@
#!/bin/sh
find . -type f -name '*.pyc' -delete
rm -rf docs/_site build dist fig.egg-info
rm -rf docs/_site build dist docker-compose.egg-info

View File

@ -1,29 +0,0 @@
#!/bin/bash
set -ex
script/build-docs
pushd docs/_site
export GIT_DIR=.git-gh-pages
export GIT_WORK_TREE=.
if [ ! -d "$GIT_DIR" ]; then
git init
fi
if !(git remote | grep origin); then
git remote add origin git@github.com:docker/fig.git
fi
git fetch origin
git reset --soft origin/gh-pages
echo ".git-gh-pages" > .gitignore
git add -A .
git commit -m "update" || echo "didn't commit"
git push origin master:gh-pages
popd

View File

@ -1,2 +0,0 @@
#!/bin/bash
open file://`pwd`/docs/_site/index.html

View File

@ -1,5 +1,5 @@
#!/bin/sh
set -ex
docker build -t fig .
docker run -v /var/run/docker.sock:/var/run/docker.sock --rm --entrypoint flake8 fig fig
docker run -v /var/run/docker.sock:/var/run/docker.sock --rm --entrypoint nosetests fig $@
docker build -t docker-compose .
docker run -v /var/run/docker.sock:/var/run/docker.sock --rm --entrypoint flake8 docker-compose compose
docker run -v /var/run/docker.sock:/var/run/docker.sock --rm --entrypoint nosetests docker-compose $@

View File

@ -48,10 +48,10 @@ if sys.version_info < (2, 7):
setup(
name='fig',
version=find_version("fig", "__init__.py"),
description='Fast, isolated development environments using Docker',
url='http://www.fig.sh/',
name='docker-compose',
version=find_version("compose", "__init__.py"),
description='Multi-container orchestration for Docker',
url='https://www.docker.com/',
author='Docker, Inc.',
license='Apache License 2.0',
packages=find_packages(exclude=[ 'tests.*', 'tests' ]),
@ -61,6 +61,6 @@ setup(
tests_require=tests_require,
entry_points="""
[console_scripts]
fig=fig.cli.main:main
docker-compose=compose.cli.main:main
""",
)

View File

@ -0,0 +1,5 @@
implicit:
image: composetest_test
explicit:
image: composetest_test
command: [ "/bin/true" ]

View File

@ -1,5 +0,0 @@
implicit:
image: figtest_test
explicit:
image: figtest_test
command: [ "/bin/true" ]

View File

@ -5,7 +5,7 @@ from six import StringIO
from mock import patch
from .testcases import DockerClientTestCase
from fig.cli.main import TopLevelCommand
from compose.cli.main import TopLevelCommand
class CLITestCase(DockerClientTestCase):
@ -14,7 +14,7 @@ class CLITestCase(DockerClientTestCase):
self.old_sys_exit = sys.exit
sys.exit = lambda code=0: None
self.command = TopLevelCommand()
self.command.base_dir = 'tests/fixtures/simple-figfile'
self.command.base_dir = 'tests/fixtures/simple-composefile'
def tearDown(self):
sys.exit = self.old_sys_exit
@ -27,43 +27,44 @@ class CLITestCase(DockerClientTestCase):
def test_help(self):
old_base_dir = self.command.base_dir
self.command.base_dir = 'tests/fixtures/no-figfile'
self.command.base_dir = 'tests/fixtures/no-composefile'
with self.assertRaises(SystemExit) as exc_context:
self.command.dispatch(['help', 'up'], None)
self.assertIn('Usage: up [options] [SERVICE...]', str(exc_context.exception))
# self.project.kill() fails during teardown
# unless there is a figfile.
# unless there is a composefile.
self.command.base_dir = old_base_dir
# TODO: address the "Inappropriate ioctl for device" warnings in test output
@patch('sys.stdout', new_callable=StringIO)
def test_ps(self, mock_stdout):
self.project.get_service('simple').create_container()
self.command.dispatch(['ps'], None)
self.assertIn('simplefigfile_simple_1', mock_stdout.getvalue())
self.assertIn('simplecomposefile_simple_1', mock_stdout.getvalue())
@patch('sys.stdout', new_callable=StringIO)
def test_ps_default_figfile(self, mock_stdout):
self.command.base_dir = 'tests/fixtures/multiple-figfiles'
def test_ps_default_composefile(self, mock_stdout):
self.command.base_dir = 'tests/fixtures/multiple-composefiles'
self.command.dispatch(['up', '-d'], None)
self.command.dispatch(['ps'], None)
output = mock_stdout.getvalue()
self.assertIn('multiplefigfiles_simple_1', output)
self.assertIn('multiplefigfiles_another_1', output)
self.assertNotIn('multiplefigfiles_yetanother_1', output)
self.assertIn('multiplecomposefiles_simple_1', output)
self.assertIn('multiplecomposefiles_another_1', output)
self.assertNotIn('multiplecomposefiles_yetanother_1', output)
@patch('sys.stdout', new_callable=StringIO)
def test_ps_alternate_figfile(self, mock_stdout):
self.command.base_dir = 'tests/fixtures/multiple-figfiles'
self.command.dispatch(['-f', 'fig2.yml', 'up', '-d'], None)
self.command.dispatch(['-f', 'fig2.yml', 'ps'], None)
def test_ps_alternate_composefile(self, mock_stdout):
self.command.base_dir = 'tests/fixtures/multiple-composefiles'
self.command.dispatch(['-f', 'compose2.yml', 'up', '-d'], None)
self.command.dispatch(['-f', 'compose2.yml', 'ps'], None)
output = mock_stdout.getvalue()
self.assertNotIn('multiplefigfiles_simple_1', output)
self.assertNotIn('multiplefigfiles_another_1', output)
self.assertIn('multiplefigfiles_yetanother_1', output)
self.assertNotIn('multiplecomposefiles_simple_1', output)
self.assertNotIn('multiplecomposefiles_another_1', output)
self.assertIn('multiplecomposefiles_yetanother_1', output)
@patch('fig.service.log')
@patch('compose.service.log')
def test_pull(self, mock_logging):
self.command.dispatch(['pull'], None)
mock_logging.info.assert_any_call('Pulling simple (busybox:latest)...')
@ -99,7 +100,7 @@ class CLITestCase(DockerClientTestCase):
self.assertFalse(config['AttachStdin'])
def test_up_with_links(self):
self.command.base_dir = 'tests/fixtures/links-figfile'
self.command.base_dir = 'tests/fixtures/links-composefile'
self.command.dispatch(['up', '-d', 'web'], None)
web = self.project.get_service('web')
db = self.project.get_service('db')
@ -109,7 +110,7 @@ class CLITestCase(DockerClientTestCase):
self.assertEqual(len(console.containers()), 0)
def test_up_with_no_deps(self):
self.command.base_dir = 'tests/fixtures/links-figfile'
self.command.base_dir = 'tests/fixtures/links-composefile'
self.command.dispatch(['up', '-d', '--no-deps', 'web'], None)
web = self.project.get_service('web')
db = self.project.get_service('db')
@ -148,7 +149,7 @@ class CLITestCase(DockerClientTestCase):
@patch('dockerpty.start')
def test_run_service_without_links(self, mock_stdout):
self.command.base_dir = 'tests/fixtures/links-figfile'
self.command.base_dir = 'tests/fixtures/links-composefile'
self.command.dispatch(['run', 'console', '/bin/true'], None)
self.assertEqual(len(self.project.containers()), 0)
@ -161,7 +162,7 @@ class CLITestCase(DockerClientTestCase):
@patch('dockerpty.start')
def test_run_service_with_links(self, __):
self.command.base_dir = 'tests/fixtures/links-figfile'
self.command.base_dir = 'tests/fixtures/links-composefile'
self.command.dispatch(['run', 'web', '/bin/true'], None)
db = self.project.get_service('db')
console = self.project.get_service('console')
@ -170,14 +171,14 @@ class CLITestCase(DockerClientTestCase):
@patch('dockerpty.start')
def test_run_with_no_deps(self, __):
self.command.base_dir = 'tests/fixtures/links-figfile'
self.command.base_dir = 'tests/fixtures/links-composefile'
self.command.dispatch(['run', '--no-deps', 'web', '/bin/true'], None)
db = self.project.get_service('db')
self.assertEqual(len(db.containers()), 0)
@patch('dockerpty.start')
def test_run_does_not_recreate_linked_containers(self, __):
self.command.base_dir = 'tests/fixtures/links-figfile'
self.command.base_dir = 'tests/fixtures/links-composefile'
self.command.dispatch(['up', '-d', 'db'], None)
db = self.project.get_service('db')
self.assertEqual(len(db.containers()), 1)
@ -193,8 +194,8 @@ class CLITestCase(DockerClientTestCase):
@patch('dockerpty.start')
def test_run_without_command(self, __):
self.command.base_dir = 'tests/fixtures/commands-figfile'
self.check_build('tests/fixtures/simple-dockerfile', tag='figtest_test')
self.command.base_dir = 'tests/fixtures/commands-composefile'
self.check_build('tests/fixtures/simple-dockerfile', tag='composetest_test')
for c in self.project.containers(stopped=True, one_off=True):
c.remove()
@ -233,7 +234,7 @@ class CLITestCase(DockerClientTestCase):
@patch('dockerpty.start')
def test_run_service_with_environement_overridden(self, _):
name = 'service'
self.command.base_dir = 'tests/fixtures/environment-figfile'
self.command.base_dir = 'tests/fixtures/environment-composefile'
self.command.dispatch(
['run', '-e', 'foo=notbar', '-e', 'allo=moto=bobo',
'-e', 'alpha=beta', name],
@ -253,7 +254,7 @@ class CLITestCase(DockerClientTestCase):
@patch('dockerpty.start')
def test_run_service_without_map_ports(self, __):
# create one off container
self.command.base_dir = 'tests/fixtures/ports-figfile'
self.command.base_dir = 'tests/fixtures/ports-composefile'
self.command.dispatch(['run', '-d', 'simple'], None)
container = self.project.get_service('simple').containers(one_off=True)[0]
@ -271,7 +272,7 @@ class CLITestCase(DockerClientTestCase):
@patch('dockerpty.start')
def test_run_service_with_map_ports(self, __):
# create one off container
self.command.base_dir = 'tests/fixtures/ports-figfile'
self.command.base_dir = 'tests/fixtures/ports-composefile'
self.command.dispatch(['run', '-d', '--service-ports', 'simple'], None)
container = self.project.get_service('simple').containers(one_off=True)[0]
@ -368,7 +369,7 @@ class CLITestCase(DockerClientTestCase):
self.assertEqual(len(project.get_service('another').containers()), 0)
def test_port(self):
self.command.base_dir = 'tests/fixtures/ports-figfile'
self.command.base_dir = 'tests/fixtures/ports-composefile'
self.command.dispatch(['up', '-d'], None)
container = self.project.get_service('simple').get_container()

View File

@ -1,13 +1,13 @@
from __future__ import unicode_literals
from fig.project import Project, ConfigurationError
from fig.container import Container
from compose.project import Project, ConfigurationError
from compose.container import Container
from .testcases import DockerClientTestCase
class ProjectTest(DockerClientTestCase):
def test_volumes_from_service(self):
project = Project.from_config(
name='figtest',
name='composetest',
config={
'data': {
'image': 'busybox:latest',
@ -29,14 +29,14 @@ class ProjectTest(DockerClientTestCase):
self.client,
image='busybox:latest',
volumes=['/var/data'],
name='figtest_data_container',
name='composetest_data_container',
)
project = Project.from_config(
name='figtest',
name='composetest',
config={
'db': {
'image': 'busybox:latest',
'volumes_from': ['figtest_data_container'],
'volumes_from': ['composetest_data_container'],
},
},
client=self.client,
@ -47,7 +47,7 @@ class ProjectTest(DockerClientTestCase):
def test_start_stop_kill_remove(self):
web = self.create_service('web')
db = self.create_service('db')
project = Project('figtest', [web, db], self.client)
project = Project('composetest', [web, db], self.client)
project.start()
@ -80,7 +80,7 @@ class ProjectTest(DockerClientTestCase):
def test_project_up(self):
web = self.create_service('web')
db = self.create_service('db', volumes=['/var/db'])
project = Project('figtest', [web, db], self.client)
project = Project('composetest', [web, db], self.client)
project.start()
self.assertEqual(len(project.containers()), 0)
@ -95,7 +95,7 @@ class ProjectTest(DockerClientTestCase):
def test_project_up_recreates_containers(self):
web = self.create_service('web')
db = self.create_service('db', volumes=['/etc'])
project = Project('figtest', [web, db], self.client)
project = Project('composetest', [web, db], self.client)
project.start()
self.assertEqual(len(project.containers()), 0)
@ -117,7 +117,7 @@ class ProjectTest(DockerClientTestCase):
def test_project_up_with_no_recreate_running(self):
web = self.create_service('web')
db = self.create_service('db', volumes=['/var/db'])
project = Project('figtest', [web, db], self.client)
project = Project('composetest', [web, db], self.client)
project.start()
self.assertEqual(len(project.containers()), 0)
@ -140,7 +140,7 @@ class ProjectTest(DockerClientTestCase):
def test_project_up_with_no_recreate_stopped(self):
web = self.create_service('web')
db = self.create_service('db', volumes=['/var/db'])
project = Project('figtest', [web, db], self.client)
project = Project('composetest', [web, db], self.client)
project.start()
self.assertEqual(len(project.containers()), 0)
@ -169,7 +169,7 @@ class ProjectTest(DockerClientTestCase):
def test_project_up_without_all_services(self):
console = self.create_service('console')
db = self.create_service('db')
project = Project('figtest', [console, db], self.client)
project = Project('composetest', [console, db], self.client)
project.start()
self.assertEqual(len(project.containers()), 0)
@ -186,7 +186,7 @@ class ProjectTest(DockerClientTestCase):
db = self.create_service('db', volumes=['/var/db'])
web = self.create_service('web', links=[(db, 'db')])
project = Project('figtest', [web, db, console], self.client)
project = Project('composetest', [web, db, console], self.client)
project.start()
self.assertEqual(len(project.containers()), 0)
@ -204,7 +204,7 @@ class ProjectTest(DockerClientTestCase):
db = self.create_service('db', volumes=['/var/db'])
web = self.create_service('web', links=[(db, 'db')])
project = Project('figtest', [web, db, console], self.client)
project = Project('composetest', [web, db, console], self.client)
project.start()
self.assertEqual(len(project.containers()), 0)
@ -219,7 +219,7 @@ class ProjectTest(DockerClientTestCase):
def test_unscale_after_restart(self):
web = self.create_service('web')
project = Project('figtest', [web], self.client)
project = Project('composetest', [web], self.client)
project.start()

View File

@ -3,9 +3,9 @@ from __future__ import absolute_import
import os
from os import path
from fig import Service
from fig.service import CannotBeScaledError
from fig.container import Container
from compose import Service
from compose.service import CannotBeScaledError
from compose.container import Container
from docker.errors import APIError
from .testcases import DockerClientTestCase
@ -23,7 +23,7 @@ class ServiceTest(DockerClientTestCase):
create_and_start_container(foo)
self.assertEqual(len(foo.containers()), 1)
self.assertEqual(foo.containers()[0].name, 'figtest_foo_1')
self.assertEqual(foo.containers()[0].name, 'composetest_foo_1')
self.assertEqual(len(bar.containers()), 0)
create_and_start_container(bar)
@ -33,8 +33,8 @@ class ServiceTest(DockerClientTestCase):
self.assertEqual(len(bar.containers()), 2)
names = [c.name for c in bar.containers()]
self.assertIn('figtest_bar_1', names)
self.assertIn('figtest_bar_2', names)
self.assertIn('composetest_bar_1', names)
self.assertIn('composetest_bar_2', names)
def test_containers_one_off(self):
db = self.create_service('db')
@ -45,7 +45,7 @@ class ServiceTest(DockerClientTestCase):
def test_project_is_added_to_container_name(self):
service = self.create_service('web')
create_and_start_container(service)
self.assertEqual(service.containers()[0].name, 'figtest_web_1')
self.assertEqual(service.containers()[0].name, 'composetest_web_1')
def test_start_stop(self):
service = self.create_service('scalingtest')
@ -86,13 +86,13 @@ class ServiceTest(DockerClientTestCase):
def test_create_container_with_one_off(self):
db = self.create_service('db')
container = db.create_container(one_off=True)
self.assertEqual(container.name, 'figtest_db_run_1')
self.assertEqual(container.name, 'composetest_db_run_1')
def test_create_container_with_one_off_when_existing_container_is_running(self):
db = self.create_service('db')
db.start()
container = db.create_container(one_off=True)
self.assertEqual(container.name, 'figtest_db_run_1')
self.assertEqual(container.name, 'composetest_db_run_1')
def test_create_container_with_unspecified_volume(self):
service = self.create_service('db', volumes=['/var/db'])
@ -146,7 +146,7 @@ class ServiceTest(DockerClientTestCase):
self.assertEqual(old_container.dictionary['Config']['Entrypoint'], ['sleep'])
self.assertEqual(old_container.dictionary['Config']['Cmd'], ['300'])
self.assertIn('FOO=1', old_container.dictionary['Config']['Env'])
self.assertEqual(old_container.name, 'figtest_db_1')
self.assertEqual(old_container.name, 'composetest_db_1')
service.start_container(old_container)
volume_path = old_container.inspect()['Volumes']['/etc']
@ -163,7 +163,7 @@ class ServiceTest(DockerClientTestCase):
self.assertEqual(new_container.dictionary['Config']['Entrypoint'], ['sleep'])
self.assertEqual(new_container.dictionary['Config']['Cmd'], ['300'])
self.assertIn('FOO=2', new_container.dictionary['Config']['Env'])
self.assertEqual(new_container.name, 'figtest_db_1')
self.assertEqual(new_container.name, 'composetest_db_1')
self.assertEqual(new_container.inspect()['Volumes']['/etc'], volume_path)
self.assertIn(intermediate_container.id, new_container.dictionary['HostConfig']['VolumesFrom'])
@ -226,8 +226,8 @@ class ServiceTest(DockerClientTestCase):
self.assertEqual(
set(web.containers()[0].links()),
set([
'figtest_db_1', 'db_1',
'figtest_db_2', 'db_2',
'composetest_db_1', 'db_1',
'composetest_db_2', 'db_2',
'db',
]),
)
@ -243,17 +243,17 @@ class ServiceTest(DockerClientTestCase):
self.assertEqual(
set(web.containers()[0].links()),
set([
'figtest_db_1', 'db_1',
'figtest_db_2', 'db_2',
'composetest_db_1', 'db_1',
'composetest_db_2', 'db_2',
'custom_link_name',
]),
)
def test_start_container_with_external_links(self):
db = self.create_service('db')
web = self.create_service('web', external_links=['figtest_db_1',
'figtest_db_2',
'figtest_db_3:db_3'])
web = self.create_service('web', external_links=['composetest_db_1',
'composetest_db_2',
'composetest_db_3:db_3'])
for _ in range(3):
create_and_start_container(db)
@ -262,8 +262,8 @@ class ServiceTest(DockerClientTestCase):
self.assertEqual(
set(web.containers()[0].links()),
set([
'figtest_db_1',
'figtest_db_2',
'composetest_db_1',
'composetest_db_2',
'db_3',
]),
)
@ -288,8 +288,8 @@ class ServiceTest(DockerClientTestCase):
self.assertEqual(
set(c.links()),
set([
'figtest_db_1', 'db_1',
'figtest_db_2', 'db_2',
'composetest_db_1', 'db_1',
'composetest_db_2', 'db_2',
'db',
]),
)
@ -299,20 +299,20 @@ class ServiceTest(DockerClientTestCase):
name='test',
client=self.client,
build='tests/fixtures/simple-dockerfile',
project='figtest',
project='composetest',
)
container = create_and_start_container(service)
container.wait()
self.assertIn('success', container.logs())
self.assertEqual(len(self.client.images(name='figtest_test')), 1)
self.assertEqual(len(self.client.images(name='composetest_test')), 1)
def test_start_container_uses_tagged_image_if_it_exists(self):
self.client.build('tests/fixtures/simple-dockerfile', tag='figtest_test')
self.client.build('tests/fixtures/simple-dockerfile', tag='composetest_test')
service = Service(
name='test',
client=self.client,
build='this/does/not/exist/and/will/throw/error',
project='figtest',
project='composetest',
)
container = create_and_start_container(service)
container.wait()

View File

@ -1,8 +1,8 @@
from __future__ import unicode_literals
from __future__ import absolute_import
from fig.service import Service
from fig.cli.docker_client import docker_client
from fig.progress_stream import stream_output
from compose.service import Service
from compose.cli.docker_client import docker_client
from compose.progress_stream import stream_output
from .. import unittest
@ -13,18 +13,18 @@ class DockerClientTestCase(unittest.TestCase):
def setUp(self):
for c in self.client.containers(all=True):
if c['Names'] and 'figtest' in c['Names'][0]:
if c['Names'] and 'composetest' in c['Names'][0]:
self.client.kill(c['Id'])
self.client.remove_container(c['Id'])
for i in self.client.images():
if isinstance(i.get('Tag'), basestring) and 'figtest' in i['Tag']:
if isinstance(i.get('Tag'), basestring) and 'composetest' in i['Tag']:
self.client.remove_image(i)
def create_service(self, name, **kwargs):
if 'command' not in kwargs:
kwargs['command'] = ["/bin/sleep", "300"]
return Service(
project='figtest',
project='composetest',
name=name,
client=self.client,
image="busybox:latest",

View File

@ -5,7 +5,7 @@ import os
import mock
from tests import unittest
from fig.cli import docker_client
from compose.cli import docker_client
class DockerClientTestCase(unittest.TestCase):

View File

@ -2,7 +2,7 @@ from __future__ import unicode_literals
from __future__ import absolute_import
from tests import unittest
from fig.cli import verbose_proxy
from compose.cli import verbose_proxy
class VerboseProxyTestCase(unittest.TestCase):

View File

@ -6,8 +6,8 @@ from .. import unittest
import mock
from fig.cli import main
from fig.cli.main import TopLevelCommand
from compose.cli import main
from compose.cli.main import TopLevelCommand
from six import StringIO
@ -16,18 +16,18 @@ class CLITestCase(unittest.TestCase):
cwd = os.getcwd()
try:
os.chdir('tests/fixtures/simple-figfile')
os.chdir('tests/fixtures/simple-composefile')
command = TopLevelCommand()
project_name = command.get_project_name(command.get_config_path())
self.assertEquals('simplefigfile', project_name)
self.assertEquals('simplecomposefile', project_name)
finally:
os.chdir(cwd)
def test_project_name_with_explicit_base_dir(self):
command = TopLevelCommand()
command.base_dir = 'tests/fixtures/simple-figfile'
command.base_dir = 'tests/fixtures/simple-composefile'
project_name = command.get_project_name(command.get_config_path())
self.assertEquals('simplefigfile', project_name)
self.assertEquals('simplecomposefile', project_name)
def test_project_name_with_explicit_uppercase_base_dir(self):
command = TopLevelCommand()
@ -41,7 +41,7 @@ class CLITestCase(unittest.TestCase):
project_name = command.get_project_name(None, project_name=name)
self.assertEquals('explicitprojectname', project_name)
def test_project_name_from_environment(self):
def test_project_name_from_environment_old_var(self):
command = TopLevelCommand()
name = 'namefromenv'
with mock.patch.dict(os.environ):
@ -49,18 +49,26 @@ class CLITestCase(unittest.TestCase):
project_name = command.get_project_name(None)
self.assertEquals(project_name, name)
def test_project_name_from_environment_new_var(self):
command = TopLevelCommand()
name = 'namefromenv'
with mock.patch.dict(os.environ):
os.environ['COMPOSE_PROJECT_NAME'] = name
project_name = command.get_project_name(None)
self.assertEquals(project_name, name)
def test_yaml_filename_check(self):
command = TopLevelCommand()
command.base_dir = 'tests/fixtures/longer-filename-figfile'
with mock.patch('fig.cli.command.log', autospec=True) as mock_log:
command.base_dir = 'tests/fixtures/longer-filename-composefile'
with mock.patch('compose.cli.command.log', autospec=True) as mock_log:
self.assertTrue(command.get_config_path())
self.assertEqual(mock_log.warning.call_count, 2)
def test_get_project(self):
command = TopLevelCommand()
command.base_dir = 'tests/fixtures/longer-filename-figfile'
command.base_dir = 'tests/fixtures/longer-filename-composefile'
project = command.get_project(command.get_config_path())
self.assertEqual(project.name, 'longerfilenamefigfile')
self.assertEqual(project.name, 'longerfilenamecomposefile')
self.assertTrue(project.client)
self.assertTrue(project.services)

View File

@ -4,7 +4,7 @@ from .. import unittest
import mock
import docker
from fig.container import Container
from compose.container import Container
class ContainerTest(unittest.TestCase):
@ -20,7 +20,7 @@ class ContainerTest(unittest.TestCase):
"Ports": None,
"SizeRw": 0,
"SizeRootFs": 0,
"Names": ["/figtest_db_1", "/figtest_web_1/db"],
"Names": ["/composetest_db_1", "/composetest_web_1/db"],
"NetworkSettings": {
"Ports": {},
},
@ -33,7 +33,7 @@ class ContainerTest(unittest.TestCase):
self.assertEqual(container.dictionary, {
"Id": "abc",
"Image":"busybox:latest",
"Name": "/figtest_db_1",
"Name": "/composetest_db_1",
})
def test_from_ps_prefixed(self):
@ -45,7 +45,7 @@ class ContainerTest(unittest.TestCase):
self.assertEqual(container.dictionary, {
"Id": "abc",
"Image":"busybox:latest",
"Name": "/figtest_db_1",
"Name": "/composetest_db_1",
})
def test_environment(self):
@ -73,7 +73,7 @@ class ContainerTest(unittest.TestCase):
container = Container.from_ps(None,
self.container_dict,
has_been_inspected=True)
self.assertEqual(container.name, "figtest_db_1")
self.assertEqual(container.name, "composetest_db_1")
def test_name_without_project(self):
container = Container.from_ps(None,

View File

@ -2,7 +2,7 @@ from __future__ import unicode_literals
from __future__ import absolute_import
import os
from fig.cli.log_printer import LogPrinter
from compose.cli.log_printer import LogPrinter
from .. import unittest

View File

@ -5,7 +5,7 @@ from tests import unittest
import mock
from six import StringIO
from fig import progress_stream
from compose import progress_stream
class ProgressStreamTestCase(unittest.TestCase):

View File

@ -1,11 +1,11 @@
from __future__ import unicode_literals
from .. import unittest
from fig.service import Service
from fig.project import Project, ConfigurationError
from compose.service import Service
from compose.project import Project, ConfigurationError
class ProjectTest(unittest.TestCase):
def test_from_dict(self):
project = Project.from_dicts('figtest', [
project = Project.from_dicts('composetest', [
{
'name': 'web',
'image': 'busybox:latest'
@ -22,7 +22,7 @@ class ProjectTest(unittest.TestCase):
self.assertEqual(project.get_service('db').options['image'], 'busybox:latest')
def test_from_dict_sorts_in_dependency_order(self):
project = Project.from_dicts('figtest', [
project = Project.from_dicts('composetest', [
{
'name': 'web',
'image': 'busybox:latest',
@ -45,7 +45,7 @@ class ProjectTest(unittest.TestCase):
self.assertEqual(project.services[2].name, 'web')
def test_from_config(self):
project = Project.from_config('figtest', {
project = Project.from_config('composetest', {
'web': {
'image': 'busybox:latest',
},
@ -61,13 +61,13 @@ class ProjectTest(unittest.TestCase):
def test_from_config_throws_error_when_not_dict(self):
with self.assertRaises(ConfigurationError):
project = Project.from_config('figtest', {
project = Project.from_config('composetest', {
'web': 'busybox:latest',
}, None)
def test_get_service(self):
web = Service(
project='figtest',
project='composetest',
name='web',
client=None,
image="busybox:latest",
@ -77,11 +77,11 @@ class ProjectTest(unittest.TestCase):
def test_get_services_returns_all_services_without_args(self):
web = Service(
project='figtest',
project='composetest',
name='web',
)
console = Service(
project='figtest',
project='composetest',
name='console',
)
project = Project('test', [web, console], None)
@ -89,11 +89,11 @@ class ProjectTest(unittest.TestCase):
def test_get_services_returns_listed_services_with_args(self):
web = Service(
project='figtest',
project='composetest',
name='web',
)
console = Service(
project='figtest',
project='composetest',
name='console',
)
project = Project('test', [web, console], None)
@ -101,20 +101,20 @@ class ProjectTest(unittest.TestCase):
def test_get_services_with_include_links(self):
db = Service(
project='figtest',
project='composetest',
name='db',
)
web = Service(
project='figtest',
project='composetest',
name='web',
links=[(db, 'database')]
)
cache = Service(
project='figtest',
project='composetest',
name='cache'
)
console = Service(
project='figtest',
project='composetest',
name='console',
links=[(web, 'web')]
)
@ -126,11 +126,11 @@ class ProjectTest(unittest.TestCase):
def test_get_services_removes_duplicates_following_links(self):
db = Service(
project='figtest',
project='composetest',
name='db',
)
web = Service(
project='figtest',
project='composetest',
name='web',
links=[(db, 'database')]
)

View File

@ -8,9 +8,9 @@ import mock
import docker
from requests import Response
from fig import Service
from fig.container import Container
from fig.service import (
from compose import Service
from compose.container import Container
from compose.service import (
ConfigError,
split_port,
build_port_bindings,
@ -203,7 +203,7 @@ class ServiceTest(unittest.TestCase):
self.assertRaises(ValueError, service.get_container)
@mock.patch('fig.service.Container', autospec=True)
@mock.patch('compose.service.Container', autospec=True)
def test_get_container(self, mock_container_class):
container_dict = dict(Name='default_foo_2')
self.mock_client.containers.return_value = [container_dict]
@ -214,15 +214,15 @@ class ServiceTest(unittest.TestCase):
mock_container_class.from_ps.assert_called_once_with(
self.mock_client, container_dict)
@mock.patch('fig.service.log', autospec=True)
@mock.patch('compose.service.log', autospec=True)
def test_pull_image(self, mock_log):
service = Service('foo', client=self.mock_client, image='someimage:sometag')
service.pull(insecure_registry=True)
self.mock_client.pull.assert_called_once_with('someimage:sometag', insecure_registry=True)
mock_log.info.assert_called_once_with('Pulling foo (someimage:sometag)...')
@mock.patch('fig.service.Container', autospec=True)
@mock.patch('fig.service.log', autospec=True)
@mock.patch('compose.service.Container', autospec=True)
@mock.patch('compose.service.log', autospec=True)
def test_create_container_from_insecure_registry(
self,
mock_log,

View File

@ -1,4 +1,4 @@
from fig.project import sort_service_dicts, DependencyError
from compose.project import sort_service_dicts, DependencyError
from .. import unittest

View File

@ -1,6 +1,6 @@
from __future__ import unicode_literals
from __future__ import absolute_import
from fig.cli.utils import split_buffer
from compose.cli.utils import split_buffer
from .. import unittest
class SplitBufferTest(unittest.TestCase):