diff --git a/cli.html b/cli.html index b4548bfe..71b6c250 100644 --- a/cli.html +++ b/cli.html @@ -6,7 +6,7 @@ - + @@ -24,33 +24,43 @@

Run fig [COMMAND] --help for full usage.

-

build

+

Commands

+ +

build

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.

-

help

+

help

Get help on a command.

-

kill

+

kill

Force stop service containers.

-

logs

+

logs

View output from services.

-

ps

+

port

+ +

Print the public port for a port binding

+ +

ps

List containers.

-

rm

+

pull

+ +

Pulls service images.

+ +

rm

Remove stopped service containers.

-

run

+

run

Run a one-off command on a service.

@@ -62,12 +72,12 @@

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 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 /bin/sh -c "psql -h \$DB_1_PORT_5432_TCP_ADDR -U docker"
+
$ fig 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
 
-

scale

+

scale

Set number of containers to run for a service.

@@ -75,15 +85,15 @@ For example:

$ fig scale web=2 worker=3
 
-

start

+

start

Start existing containers for a service.

-

stop

+

stop

Stop running containers without removing them. They can be started again with fig start.

-

up

+

up

Build, (re)create, start and attach to containers for a service.

@@ -92,6 +102,32 @@ For example:

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 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.

+ +

Environment Variables

+ +

Several environment variables can be used to configure Fig'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.

+ +

FIG_FILE

+ +

Set the path to the fig.yml to use. Defaults to fig.yml in the current working directory.

+ +

DOCKER_HOST

+ +

Set the URL to the docker daemon. Defaults to unix:///var/run/docker.sock, as with the docker client.

+ +

DOCKER_TLS_VERIFY

+ +

When set to anything other than an empty string, enables TLS communication with the daemon.

+ +

DOCKER_CERT_PATH

+ +

Configure the path to the ca.pem, cert.pem and key.pem files used for TLS verification. Defaults to ~/.docker.

-

And your Django app should be running at localhost:8000 (or localdocker:8000 if you're using docker-osx).

+

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:

$ fig run web python manage.py syncdb
diff --git a/env.html b/env.html
index 3943dd88..b0ad2a5d 100644
--- a/env.html
+++ b/env.html
@@ -6,7 +6,7 @@
     
     
     
-    
+    
     
   
   
@@ -20,24 +20,26 @@
 
       

Environment variables reference

-

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.

+

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 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.

To see what environment variables are available to a service, run fig run SERVICE env.

name_PORT
-Full URL, e.g. DB_1_PORT=tcp://172.17.0.5:5432

+Full URL, e.g. DB_PORT=tcp://172.17.0.5:5432

name_PORT_num_protocol
-Full URL, e.g. DB_1_PORT_5432_TCP=tcp://172.17.0.5:5432

+Full URL, e.g. DB_PORT_5432_TCP=tcp://172.17.0.5:5432

name_PORT_num_protocol_ADDR
-Container's IP address, e.g. DB_1_PORT_5432_TCP_ADDR=172.17.0.5

+Container's IP address, e.g. DB_PORT_5432_TCP_ADDR=172.17.0.5

name_PORT_num_protocol_PORT
-Exposed port number, e.g. DB_1_PORT_5432_TCP_PORT=5432

+Exposed port number, e.g. DB_PORT_5432_TCP_PORT=5432

name_PORT_num_protocol_PROTO
-Protocol (tcp or udp), e.g. DB_1_PORT_5432_TCP_PROTO=tcp

+Protocol (tcp or udp), e.g. DB_PORT_5432_TCP_PROTO=tcp

name_NAME
Fully qualified container name, e.g. DB_1_NAME=/myapp_web_1/myapp_db_1

diff --git a/index.html b/index.html index 9bbb3495..ea1ead53 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ - + @@ -67,7 +67,7 @@ $ cd figtest from redis import Redis import os app = Flask(__name__) -redis = Redis(host="redis_1", port=6379) +redis = Redis(host='redis', port=6379) @app.route('/') def hello(): @@ -118,7 +118,7 @@ Starting figtest_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/
-

Open up http://localhost:5000 in your browser (or http://localdocker:5000 if you're using docker-osx) and you should see it running!

+

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:

$ fig up -d
diff --git a/install.html b/install.html
index 8782f454..babb1001 100644
--- a/install.html
+++ b/install.html
@@ -6,7 +6,7 @@
     
     
     
-    
+    
     
   
   
@@ -20,22 +20,19 @@
 
       

Installing Fig

-

First, install Docker version 1.0 or greater. If you're on OS X, you can use docker-osx:

-
$ curl https://raw.githubusercontent.com/noplay/docker-osx/1.1.1/docker-osx > /usr/local/bin/docker-osx
-$ chmod +x /usr/local/bin/docker-osx
-$ docker-osx shell
-
-

Docker has guides for Ubuntu and other platforms in their documentation.

+

First, install Docker version 1.3 or greater.

-

Next, install Fig. On OS X:

-
$ curl -L https://github.com/docker/fig/releases/download/0.5.2/darwin > /usr/local/bin/fig
-$ chmod +x /usr/local/bin/fig
+

If you're on OS X, you can use the OS X installer to install both Docker and boot2docker. Once boot2docker is running, set the environment variables that'll configure Docker and Fig to talk to it:

+
$(boot2docker shellinit)
 
-

On 64-bit Linux:

-
$ curl -L https://github.com/docker/fig/releases/download/0.5.2/linux > /usr/local/bin/fig
-$ chmod +x /usr/local/bin/fig
+

To persist the environment variables across shell sessions, you can add that line to your ~/.bashrc file.

+ +

There are also guides for Ubuntu and other platforms in Docker’s documentation.

+ +

Next, install Fig:

+
curl -L https://github.com/docker/fig/releases/download/1.0.0/fig-`uname -s`-`uname -m` > /usr/local/bin/fig; chmod +x /usr/local/bin/fig
 
-

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. Fig 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
 

That should be all you need! Run fig --version to see if it worked.

diff --git a/rails.html b/rails.html index 2d26d9a8..8652bfd9 100644 --- a/rails.html +++ b/rails.html @@ -6,7 +6,7 @@ - + @@ -79,7 +79,7 @@ Rakefile db test pool: 5 username: postgres password: - host: db_1 + host: db test: <<: *default @@ -96,7 +96,7 @@ myapp_web_1 | [2014-01-17 17:16:29] INFO WEBrick::HTTPServer#start: pid=1 port=

Finally, we just need to create the database. In another terminal, run:

$ fig run web rake db:create
 
-

And we're rolling—see for yourself at localhost:3000 (or localdocker:3000 if you're using docker-osx).

+

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

diff --git a/wordpress.html b/wordpress.html index fd31674d..3236dade 100644 --- a/wordpress.html +++ b/wordpress.html @@ -6,7 +6,7 @@ - + @@ -49,7 +49,7 @@ db: define('DB_NAME', 'wordpress'); define('DB_USER', 'root'); define('DB_PASSWORD', ''); -define('DB_HOST', getenv("DB_1_PORT_3306_TCP_ADDR") . ":" . getenv("DB_1_PORT_3306_TCP_PORT")); +define('DB_HOST', "db:3306"); define('DB_CHARSET', 'utf8'); define('DB_COLLATE', ''); @@ -89,7 +89,7 @@ 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 and set it up by visiting localhost:8000 - or localdocker:8000 if you're using docker-osx.

+

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).

volumes

-

Mount paths as volumes, optionally specifying a path on the host machine (HOST:CONTAINER).

- -

Note: Mapping local volumes is currently unsupported on boot2docker. We recommend you use docker-osx if want to map local volumes.

+

Mount paths as volumes, optionally specifying a path on the host machine +(HOST:CONTAINER), or an access mode (HOST:CONTAINER:ro).

volumes:
  - /var/lib/mysql
  - cache/:/tmp/cache
+ - ~/configs:/etc/configs/:ro
 

volumes_from