adding a host to the docker command

42 views
Skip to first unread message

angel.m...@gmail.com

unread,
Dec 2, 2021, 7:52:05 PM12/2/21
to xnat_discussion
Hi, 
I've got a docker container that needs to access a particular port on the host machine. It  looks like I need to be able to set this up as part of the command.json but it's not clear to me where I can put it. 

If I was running the docker container directly the command would look something like this.
docker run --add-host="app-backend:10.15.1.24" my-app  

Is there a way of getting this into the json command for launch from xnat?

thanks
Angel

kel...@wustl.edu

unread,
Dec 3, 2021, 9:36:50 AM12/3/21
to xnat_discussion
Hi Angel,
The --add-host flag is not supported in the XNAT Container Service command structure.  Containers running under Container Service do have a few environment variables set by default, including XNAT_HOST.

Using this env var, or any other input you supply to the command, you could append the /etc/hosts file as part of your container's run script. e.g. 
      > echo $XNAT_HOST app-backend >> /etc/host
at container startup.

Best,
Matt

Reply all
Reply to author
Forward
0 new messages