You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**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.
10
+
9
11
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.
10
12
11
13
To see what environment variables are available to a service, run `fig run SERVICE env`.
Copy file name to clipboardExpand all lines: docs/yml.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,10 +36,10 @@ Override the default command.
36
36
command: bundle exec thin -p 3000
37
37
```
38
38
39
+
<aname="links"></a>
39
40
### links
40
41
41
-
42
-
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`
42
+
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).
43
43
44
44
```
45
45
links:
@@ -48,6 +48,16 @@ links:
48
48
- redis
49
49
```
50
50
51
+
An entry with the alias' name will be created in `/etc/hosts` inside containers for this service, e.g:
52
+
53
+
```
54
+
172.17.2.186 db
55
+
172.17.2.186 database
56
+
172.17.2.187 redis
57
+
```
58
+
59
+
Environment variables will also be created - see the [environment variable reference](env.html) for details.
60
+
51
61
### ports
52
62
53
63
Expose ports. Either specify both ports (`HOST:CONTAINER`), or just the container port (a random host port will be chosen).
0 commit comments