From 57f53c031be81d0ae0b2c64b5d9e6337b9c7cbbd Mon Sep 17 00:00:00 2001 From: zhangbaitong Date: Thu, 15 Jan 2015 10:17:25 +0800 Subject: [PATCH 1/2] finished fig env ref --- fig/env_ref.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 fig/env_ref.md diff --git a/fig/env_ref.md b/fig/env_ref.md new file mode 100644 index 0000000..22de8eb --- /dev/null +++ b/fig/env_ref.md @@ -0,0 +1,31 @@ +##环境变量参考 + +*注意: 现在已经不推荐使用环境变量链接服务。替代方案是使用链接名称(默认就是被连接的服务名字)作为主机名来链接。详情查看 [fig.yml章节](./yml_ref.md)。 + +Fig 使用 Docker 链接来暴露一个服务的容器给其它容器。每一个链接的容器会注入一组以容器名称的大写字母开头得环境变量。 + +查看一个服务有那些有效的环境变量可以执行 `fig run SERVICE env`. + +`name_PORT` + +完整URL,例如: `DB_PORT=tcp://172.17.0.5:5432` + +`name_PORT_num_protocol` + +完整URL,例如: `DB_PORT_5432_TCP=tcp://172.17.0.5:5432` + +`name_PORT_num_protocol_ADDR` + +容器的IP地址,例如: `DB_PORT_5432_TCP_ADDR=172.17.0.5` + +`name_PORT_num_protocol_PORT` + +暴露端口号,例如: `DB_PORT_5432_TCP_PORT=5432` + +`name_PORT_num_protocol_PROTO` + +协议(tcp 或 udp),例如: `DB_PORT_5432_TCP_PROTO=tcp` + +`name_NAME` + +完整合格的容器名称,例如: `DB_1_NAME=/myapp_web_1/myapp_db_1` \ No newline at end of file From ff130ef077a2bead01298dd290ce4c3b47236f59 Mon Sep 17 00:00:00 2001 From: zhangbaitong Date: Thu, 15 Jan 2015 10:18:12 +0800 Subject: [PATCH 2/2] finished fig env ref --- SUMMARY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/SUMMARY.md b/SUMMARY.md index 467c848..8a4f041 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -78,6 +78,7 @@ * [安装](fig/install.md) * [命令参考](fig/cli_ref.md) * [fig.yml参考](fig/yml_ref.md) + * [环境变量参考](fig/env_ref.md) * [实战 Django](fig/django.md) * [实战 Rails](fig/rails.md) * [实战 wordpress](fig/wordpress.md)