Merge pull request #364 from docker/non-numeric-link-alias

Non-numeric link alias
This commit is contained in:
Ben Firshman 2014-09-04 20:39:18 +01:00
commit 2827786886
9 changed files with 68 additions and 23 deletions

View file

@ -36,10 +36,10 @@ Override the default command.
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_1_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:
@ -48,6 +48,16 @@ links:
- redis
```
An entry with the alias' name will be created in `/etc/hosts` inside containers for this service, e.g:
```
172.17.2.186 db
172.17.2.186 database
172.17.2.187 redis
```
Environment variables will also be created - see the [environment variable reference](env.html) for details.
### ports
Expose ports. Either specify both ports (`HOST:CONTAINER`), or just the container port (a random host port will be chosen).