I have a server with a set of additional IPs on which I can launch & attach a docker instance.
The easiest way is to use -p option (-p IP:port:port) of docker.
Alternatively, we also manage to use the IPs using a dedicated docker network & a set of iptables PREROUTING/POSTROUTING rules
docker network create --driver bridge --subnet=[login to view URL] --opt "[login to view URL]"="docker1" docker1
/sbin/ip addr add EXTERNAL_IP dev inducido
add route command for the gateway
iptables -t nat -A PREROUTING -d EXTERNAL_IP -j DNAT --to-destination INTERNAL_IP
and several other rules.
Everything works well, except that the outside world sees the host's IP for outgoing traffic.
I need someone expert with network & iptables to fix this, namely every packet going out of the docker instance shall be associated with the related IP.
(Debian 10 server)
I can give it a try. May be I can help you. Thanks!