@Squid Thank you for the answer. I have a similar issue/requirement. Let me explain.
I'd like each docker container to run on its own IP address. And its' internal whatever port to be mapped to host's port 443 for HTTPS communication on that unique IP address.
I do still want to access Unraid GUI on its own IP on port 443 as well. I do not want to enter any port numbers in address bar.
Example:
Given Unraid GUI is running on IP=192.168.0.15 and listens on port 443 as I have added Let's Encrypt SSL cert manually
And I have a docker container that I want to accesss from a different IP address ( like 192.168.0.20 )and on port 443(default for HTTPS) as well
And internally, the container is listens to port 8888
The question: How do I set up that container to be on IP 192.168.0.20? And to map host port 443 onto container's 8888?
I have tried:
One:
-p 192.168.0.20:443:8888
Network = eth0
Result: docker selects some port, ignores the IP and port I selected. The container can be accesses only from that selection: eth0 192.168.0.2:8888/TCP192.168.0.2:8888
Two:
-p 192.168.0.20:443:8888
Network = host
Result: docker selects some port, ignores the IP and port I selected. The container can be accesses only from that selection: eth0 192.168.0.2:8888/TCP192.168.0.2:8888
Three:
Added 192.168.0.20 IP address on host as ip addr add 192.168.10.20/24 dev eth0
-p 192.168.0.20:443:8888
Network = bridge
Result: Error starting userland proxy: listen tcp 192.168.0.20:443: bind: address already in use.
Four:
-p 192.168.0.30:443:8888
Network = bridge
Result: Error starting userland proxy: listen tcp 192.168.0.30:443: bind: cannot assign requested address.
I might miss on smth with respect to networking in docker, any advice how to achieve the given task is appreciated. Or if it cannot be done then a clear answer why is also important, so I move on to another option (I have several spare LAN ports not used but available to UnRaid, so I was considering to set dockers on their own LAN network throw a nginx proxy)