Configure containers to send messages using their external IP

Hi all!

I’m using docker containers on a Ubuntu 14.04 host to run simulated hardware devices at work. I configuring virtual ethernet adapters to expose each container, and then run with -p ExternalAddress:ExternalPort:InternalPort. Messages are able to go in/out of the containers as expected. I can ping the external devices that I want to talk to from the containers, and I can ping the containers from the external devices.

When I look at the network traffic though, the messages leaving the containers show the host IP . . . not the external IP configured for the container to use. Is there some easy way that I can make the messages coming from the containers use the external address that they’ve been assigned rather than the host IP?

Thanks,

  • Steven

Please use macvlan driver for your usecase(https://docs.docker.com/engine/userguide/networking/get-started-macvlan/, https://sreeninet.wordpress.com/2016/05/29/docker-macvlan-and-ipvlan-network-plugins/)

regards
Sreenivas