mirror of https://github.com/docker/compose.git
Find-and-replace on docs
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
parent
c981ce929a
commit
e3c4a662d9
38
docs/cli.md
38
docs/cli.md
|
@ -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 docker-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. `docker-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 condocker-compose 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 condocker-composeure 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.
|
||||
Variables starting with `DOCKER_` are the same as those used to condocker-composeure 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
|
||||
|
||||
|
@ -144,4 +144,4 @@ When set to anything other than an empty string, enables TLS communication with
|
|||
|
||||
### DOCKER\_CERT\_PATH
|
||||
|
||||
Configure the path to the `ca.pem`, `cert.pem` and `key.pem` files used for TLS verification. Defaults to `~/.docker`.
|
||||
Condocker-composeure the path to the `ca.pem`, `cert.pem` and `key.pem` files used for TLS verification. Defaults to `~/.docker`.
|
||||
|
|
|
@ -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 docker-compose faster and with less typos!
|
||||
|
|
|
@ -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 docker-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 docker-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 docker-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 `docker-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 'docker-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
|
||||
|
||||
|
|
|
@ -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`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
layout: default
|
||||
title: Fig | Fast, isolated development environments using Docker
|
||||
title: Compose | Fast, isolated development environments using Docker
|
||||
---
|
||||
|
||||
<strong class="strapline">Fast, isolated development environments using Docker.</strong>
|
||||
|
@ -12,7 +12,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 +28,9 @@ db:
|
|||
|
||||
(No more installing Postgres on your laptop!)
|
||||
|
||||
Then type `fig up`, and Fig will start and run your entire app:
|
||||
Then type `docker-compose up`, and Compose will start and run your entire app:
|
||||
|
||||
![example fig run](https://orchardup.com/static/images/fig-example-large.gif)
|
||||
![example docker-compose run](https://orchardup.com/static/images/docker-compose-example-large.gif)
|
||||
|
||||
There are commands to:
|
||||
|
||||
|
@ -43,14 +43,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 docker-composetest
|
||||
$ cd docker-composetest
|
||||
|
||||
Inside this directory, create `app.py`, a simple web app that uses the Flask framework and increments a value in Redis:
|
||||
|
||||
|
@ -84,7 +84,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 +103,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 docker-composetest_redis_1...
|
||||
Starting docker-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 docker-composetest_redis_1...
|
||||
Starting docker-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
|
||||
docker-composetest_redis_1 /usr/local/bin/run Up
|
||||
docker-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, condocker-composeuration file and environment variables. If you have any thoughts or suggestions, [open an issue on GitHub](https://github.com/docker/docker-compose).
|
||||
|
|
|
@ -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 condocker-composeure 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 Docker’s 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.
|
||||
|
|
|
@ -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 condocker-composeuration we need to link them together and expose the web app's port.
|
||||
|
||||
db:
|
||||
image: postgres
|
||||
|
@ -41,17 +41,17 @@ 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
|
||||
Gemfile.lock condocker-compose log
|
||||
README.rdoc condocker-compose.ru public
|
||||
Rakefile db test
|
||||
|
||||
Uncomment the line in your new `Gemfile` which loads `therubyracer`, so we've got a Javascript runtime:
|
||||
|
@ -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,8 @@ 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)
|
||||
![Screenshot of Rails' stock index.html](https://orchardup.com/static/images/docker-compose-rails-screenshot.png)
|
||||
|
|
|
@ -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:
|
||||
|
@ -37,7 +37,7 @@ db:
|
|||
MYSQL_DATABASE: wordpress
|
||||
```
|
||||
|
||||
Two supporting files are needed to get this working - first up, `wp-config.php` is the standard Wordpress config file with a single change to point the database configuration at the `db` container:
|
||||
Two supporting files are needed to get this working - first up, `wp-condocker-compose.php` is the standard Wordpress condocker-compose file with a single change to point the database condocker-composeuration at the `db` container:
|
||||
|
||||
```
|
||||
<?php
|
||||
|
@ -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).
|
||||
|
|
18
docs/yml.md
18
docs/yml.md
|
@ -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 docker-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`).
|
||||
|
||||
```
|
||||
|
@ -103,7 +103,7 @@ Mount paths as volumes, optionally specifying a path on the host machine
|
|||
volumes:
|
||||
- /var/lib/mysql
|
||||
- cache/:/tmp/cache
|
||||
- ~/configs:/etc/configs/:ro
|
||||
- ~/condocker-composes:/etc/condocker-composes/:ro
|
||||
```
|
||||
|
||||
### volumes_from
|
||||
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue