How to configure a Docker container to be reachable by container_ip:port from outside the host machine?

前端 未结 2 975
小鲜肉
小鲜肉 2021-01-02 03:57

I have a host machine with multiple IP addresses assigned to one network interface. I\'d like to configure Docker in order to have containers \"responding\" each one to a si

2条回答
  •  太阳男子
    2021-01-02 04:09

    It's possible using the docker run --net command.

    Official documentation : https://docs.docker.com/articles/networking/#how-docker-networks-a-container

    First thing to do would be to create your own bridge using the official tutorial : https://docs.docker.com/articles/networking/#building-your-own-bridge

    Or modify the existing one : https://docs.docker.com/articles/networking/#customizing-docker0

    Then you will running your container will map his ip address into the table.

    If you wanna be specific using the docker run --net=none command will let you configure your docker IP address.

提交回复
热议问题