How to access host port from docker container

前端 未结 14 1545
南旧
南旧 2020-11-22 03:41

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 s

14条回答
  •  不思量自难忘°
    2020-11-22 03:51

    Solution with docker-compose: For accessing to host-based service, you can use network_mode parameter https://docs.docker.com/compose/compose-file/#network_mode

    version: '3'
    services:
      jenkins:
        network_mode: host
    

    EDIT 2020-04-27: recommended for use only in local development environment.

提交回复
热议问题