gvtci Posted August 15, 2023 Share Posted August 15, 2023 Hi all; I've a question that I hope someone can help me with. I want to map a static ip address that only responds to one docker. I added the ip to a different eth but all the dockers respond on it. Can anyone tell me how to accomplish this? Quote Link to comment
JorgeB Posted August 16, 2023 Share Posted August 16, 2023 Set he container to use a custom network, then specify the IP, e.g.: Quote Link to comment
gvtci Posted August 16, 2023 Author Share Posted August 16, 2023 Hi Jorge; Thank You for answering my question, but now another question arises. I've 20 dockers that I want to run do I need to burn a live ip address for each docker? I would like to use the same ip address but with different port numbers. Please advise. Thank You again. Quote Link to comment
JorgeB Posted August 17, 2023 Share Posted August 17, 2023 Not all dockers need a custom IP, most don't, use bridge or host mode. Quote Link to comment
Solution sphbecker Posted August 17, 2023 Solution Share Posted August 17, 2023 18 hours ago, gvtci said: Hi Jorge; Thank You for answering my question, but now another question arises. I've 20 dockers that I want to run do I need to burn a live ip address for each docker? I would like to use the same ip address but with different port numbers. Please advise. Thank You again. Your best bet for a GUI configuration is to use the Bridge network, which creates an internal subnet for your dockers and allows port mapping from the UNRAID server's IP address to specific dockers. It works great, the only downside is sharing the server's native IP might lead to port number conflicts. You can work around that by using non-standard port numbers, such as 8443 instead of 443, but that can get annoying. If you don't mind dipping into the command line, you can create your own custom docker network using the bridge driver, which will work the same as above, but allows you to bind the docker network with a different local IP address; meaning your dockers could use a different LAN IP address than your server, which sounds like what you are looking for. Quote Link to comment
gvtci Posted August 18, 2023 Author Share Posted August 18, 2023 Thank You for your help guys. I am just going to configure them with command line. Quote Link to comment
sphbecker Posted August 19, 2023 Share Posted August 19, 2023 (edited) 4 hours ago, gvtci said: Thank You for your help guys. I am just going to configure them with command line. This is what I did. Run a command like this to give Unraid a 2nd IP address on the default br0 interface. ip addr add 192.168.1.22/24 dev br0 That will only last until your next reboot, so add the command to the /boot/config/go script to rerun on each reboot; it should be above the command to start emhttp. At that point you have two choices, you can edit your docker container and instead of providing only a port number like 443, you can provide IP and port in this format 192.168.1.22:443. Now that docker will use the new IP address instead of Unraid's IP address. That is probably the easiest way to do it. If you have a lot of dockers working together for a specific purpose, you might want to create a custom docker network that binds to the 2nd IP address. That can be done with this command. Note, that command is permanent, no need to add to the go script. docker network create -o "com.docker.network.bridge.host_binding_ipv4"="192.168.1.22" my-docker-network At that point, any docker container you assign to my-docker-network will use the IP provided with any ports you specify. Important note: there is a bug/limitation in Unraid's docker GUI. The port mapping information shown on the status screen will incorrectly show the ports mapped to the server's IP address, however, they should work correctly using the custom IP address, this is only a display bug. Edited August 19, 2023 by sphbecker 1 Quote Link to comment
ninjaneer68 Posted December 19, 2023 Share Posted December 19, 2023 if I am happy with the internally docker IP's 172.*, how can I static assign them, vs them changing ? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.