dstack icon indicating copy to clipboard operation
dstack copied to clipboard

Expose the private IP address in a system environment variable

Open jvstme opened this issue 11 months ago • 2 comments

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

jvstme avatar Jan 23 '25 19:01 jvstme