Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Adding a static ip to just one docker

Featured Replies

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?

Solved by sphbecker

  • Community Expert

Set he container to use a custom network, then specify the IP, e.g.:

 

image.png

  • Author

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.

  • Community Expert

Not all dockers need a custom IP, most don't, use bridge or host mode.

  • Solution
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.

  • Author

Thank You for your help guys. I am just going to configure them with command line.

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 by sphbecker

  • 4 months later...

if I am happy with the internally docker IP's 172.*, how can I static assign them, vs them changing ? 

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.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.