How to access host port from docker container
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a docker container running jenkins. As part of the build process, I need to access a web server that is run locally on the host machine. Is there a way the host web server (which can be configured to run on a port) can be exposed to the jenkins container? EDIT: I'm running docker natively on a Linux machine. UPDATE: In addition to @larsks answer below, to get the IP address of the Host IP from the host machine, I do the following: ip addr show docker0 | grep -Po 'inet \K[\d.]+' 回答1: When running Docker natively on Linux, you can