dstack
dstack copied to clipboard
Expose the private IP address in a system environment variable
Problem
A node in a distributed task may need to know its own private IP address, e.g. to bind a socket to it or for logging purposes.
Currently, there isn't an easy way for a node to find out its private IP address.
Solution
Provide a new system environment variable containing the private IP of the current node, e.g. DSTACK_NODE_IP.
Workaround
dstack already provides the DSTACK_NODES_IPS variable with a list of all nodes' IP addresses, so the node can try comparing the value of this variable with the output of ifconfig or ip.
Would you like to help us implement this feature by sending a PR?
Yes