Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Docker Fig environment variable reference


May 22, 2021 Docker From entry to practice



Note: The use of environment variable link services is no longer recommended. T he alternative is to use the link name (the default is the name of the connected service) as the host name. See the fig.yml section for details.

Fig uses the Docker link to expose one service's container to another. Each linked container injects a set of environment variables that begin with capital letters of the container name.

View a service that has those valid environment variables that can fig run SERVICE env

name_PORT

Full URL, DB_PORT=tcp://172.17.0.5:5432

name_PORT_num_protocol

Full URL, DB_PORT_5432_TCP=tcp://172.17.0.5:5432

name_PORT_num_protocol_ADDR

The IP address of the container, DB_PORT_5432_TCP_ADDR=172.17.0.5

name_PORT_num_protocol_PORT

Exposed port number, DB_PORT_5432_TCP_PORT=5432

name_PORT_num_protocol_PROTO

Protocol (tcp or udp), DB_PORT_5432_TCP_PROTO=tcp

name_NAME

A fully qualified container name, DB_1_NAME=/myapp_web_1/myapp_db_1