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?


  • Steven

Please use macvlan driver for your usecase(,