HOST_OS = "unraid" env var, how about HOST_HOSTNAME = $HOSTNAME?


Recommended Posts

Very handily the docker code automatically creates a HOST_OS = "unraid" env var in each container, can we make it automatically create a HOST_HOSTNAME = $HOSTNAME (i.e. the unraid server's hostname) as well? 

 

and yes, i know i can just do it in "Extra Parameters" for each container - but it'd be handy to have it there automatically. 

 

-e HOST_HOSTNAME=$HOSTNAME

 

 

making the container name available within all containers would probably be useful too.....

 

 

Link to comment

Because I was interested to have a play (and just for S&G), i've modded my /usr/local/emhttp/plugins/dynamix.docker.manager/include/Helpers.php file

 

 

274   // Add HOST_HOSTNAME variable
275   $Variables[]   = 'HOST_HOSTNAME=$HOSTNAME';
276   // Add HOST_CONTAINERNAME variable
277   $Variables[]   = 'HOST_CONTAINERNAME='.escapeshellarg($xml['Name']);

 

 

All seems to work fine

 

Why would I want this, i hear you cry?

 

Well, in my "Firefox" container the tab name being "Guacamole Client" gave me the poops (being polite!) - so I stuck the following in appdata/firefox/custom-cont-init.d/00.set.guac.page.title.sh

 

filename="/gclient/rdp.ejs"
echo 
echo ----------------------------------------------------------------------------------
echo 
echo "Set the Guacamole Client page title in \"${filename}\""
echo 
echo "Before"
echo "------"
grep "<title>" $filename
sed -i "s+<title>Guacamole Client</title>+<title>${HOST_OS} ${HOST_HOSTNAME} ${HOST_CONTAINERNAME}</title>+g" $filename
echo 
echo "After"
echo "-----"
grep "<title>" $filename
echo 
echo ----------------------------------------------------------------------------------
echo 


 

 

so now my tab is titled "Unraid skynet firefox" - much more OCD friendly....

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.