Search code examples
dockerdocker-network

docker networking in Multi host in same network


I have two ubuntu os in my system . I install docker in both ubuntu and create a containers in both the dockers and i need to communicate with the networks ...


Solution

  • Run your container using option --net=host. This way, both containers will have an IP address in your local network.

    An example for a container called ubuntu: docker run -d --name ubuntu --net=host ubuntu