Repository navigation
How to pass hostIP and hostname in environment variables #192
|
May I ask, how can I obtain the IP and hostname of the host computer for my container? |
Answered by
psviderski
Nov 24, 2025
Replies: 1 comment
|
Uncloud doesn't automatically inject environment variables to service containers with the host IP or hostname values. But you can try injecting these values via binding a file from the host to the container. First, create a file on the host, e.g. at Then in your Compose file bind mount this file to the service container at Then you can access In this case, |
0 replies
Answer selected by
mx1700
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uncloud doesn't automatically inject environment variables to service containers with the host IP or hostname values. But you can try injecting these values via binding a file from the host to the container.
First, create a file on the host, e.g. at
/opt/uncloud/host_info:Then in your Compose file bind mount this file to the service container at
/host_info:Then you can access
/host_infofrom the process inside your container. You can also try changing the command that runs in the container to something like:In th…