mirror of https://github.com/docker/compose.git
Update docs to remove numeric suffix
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
parent
62a4d214e8
commit
59e31ff544
|
@ -51,7 +51,7 @@ One-off commands are started in new containers with the same config as a normal
|
|||
|
||||
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_1 -U postgres
|
||||
$ 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:
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ First thing we need to do is set up the database connection. Replace the `DATABA
|
|||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 'postgres',
|
||||
'USER': 'postgres',
|
||||
'HOST': 'db_1',
|
||||
'HOST': 'db',
|
||||
'PORT': 5432,
|
||||
}
|
||||
}
|
||||
|
|
12
docs/env.md
12
docs/env.md
|
@ -6,26 +6,26 @@ title: Fig 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, <b><i>name</i>_1</b>) 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 [fig.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.
|
||||
|
||||
To see what environment variables are available to a service, run `fig run SERVICE env`.
|
||||
|
||||
<b><i>name</i>\_PORT</b><br>
|
||||
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`
|
||||
|
||||
<b><i>name</i>\_PORT\_<i>num</i>\_<i>protocol</i></b><br>
|
||||
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`
|
||||
|
||||
<b><i>name</i>\_PORT\_<i>num</i>\_<i>protocol</i>\_ADDR</b><br>
|
||||
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`
|
||||
|
||||
<b><i>name</i>\_PORT\_<i>num</i>\_<i>protocol</i>\_PORT</b><br>
|
||||
Exposed port number, e.g. `DB_1_PORT_5432_TCP_PORT=5432`
|
||||
Exposed port number, e.g. `DB_PORT_5432_TCP_PORT=5432`
|
||||
|
||||
<b><i>name</i>\_PORT\_<i>num</i>\_<i>protocol</i>\_PROTO</b><br>
|
||||
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`
|
||||
|
||||
<b><i>name</i>\_NAME</b><br>
|
||||
Fully qualified container name, e.g. `DB_1_NAME=/myapp_web_1/myapp_db_1`
|
||||
|
|
|
@ -59,7 +59,7 @@ from flask import Flask
|
|||
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():
|
||||
|
|
|
@ -73,7 +73,7 @@ Open up your newly-generated `database.yml`. Replace its contents with the follo
|
|||
pool: 5
|
||||
username: postgres
|
||||
password:
|
||||
host: db_1
|
||||
host: db
|
||||
|
||||
test:
|
||||
<<: *default
|
||||
|
|
|
@ -44,7 +44,7 @@ Two supporting files are needed to get this working - first up, `wp-config.php`
|
|||
define('DB_NAME', 'wordpress');
|
||||
define('DB_USER', 'root');
|
||||
define('DB_PASSWORD', '');
|
||||
define('DB_HOST', "db_1:3306");
|
||||
define('DB_HOST', "db:3306");
|
||||
define('DB_CHARSET', 'utf8');
|
||||
define('DB_COLLATE', '');
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ command: bundle exec thin -p 3000
|
|||
<a name="links"></a>
|
||||
### links
|
||||
|
||||
Link to containers in another service. Optionally specify an alternate name for the link, which will determine how environment variables are prefixed, e.g. `db` -> `DB_1_PORT`, `db:database` -> `DATABASE_PORT`
|
||||
Link to containers in another service. Either specify both the service name and the link alias (`SERVICE:ALIAS`), or just the service name (which will also be used for the alias).
|
||||
|
||||
```
|
||||
links:
|
||||
|
@ -51,9 +51,9 @@ links:
|
|||
An entry with the alias' name will be created in `/etc/hosts` inside containers for this service, e.g:
|
||||
|
||||
```
|
||||
172.17.2.186 db_1
|
||||
172.17.2.186 db
|
||||
172.17.2.186 database
|
||||
172.17.2.187 redis_1
|
||||
172.17.2.187 redis
|
||||
```
|
||||
|
||||
Environment variables will also be created - see the [environment variable reference](env.html) for details.
|
||||
|
|
Loading…
Reference in New Issue