My network configuration looks something like this on a docker host:
➜ server git:(master) ✗ ip addr
3: ens9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:02:c9:bb:3b:f4 brd ff:ff:ff:ff:ff:ff
inet <IP Address>.18/29 brd <Default Gateway>.23 scope global ens9
valid_lft forever preferred_lft forever
inet <IP Address>.19/29 brd <Default Gateway>.23 scope global secondary ens9:0
valid_lft forever preferred_lft forever
Currently, I have existing non-Docker services running on port 443
on the .18
IP address, and I need to keep it that way. However, when I open a port using a Dockerfile
, it fails to start because port 443
is already in use by the host.
Is there a way to globally switch the IP address that Docker uses when opening a port up? I do not want to have to set this manually on each container's configuration file, which of course already works.