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.

IP address assignment to Docker containers

Featured Replies

I'm not clear on the IP address assignment to a docker.  I want to assign the static IP address 192.168.1.8 to my ownCloud docker.  How do I go about doing that?  How does the docker pick up that IP address?

  • Replies 63
  • Views 20.9k
  • Created
  • Last Reply
5 minutes ago, dlandon said:

I'm not clear on the IP address assignment to a docker.  I want to assign the static IP address 192.168.1.8 to my ownCloud docker.  How do I go about doing that?  How does the docker pick up that IP address?

 

Change Network Type of a container to a custom network, e.g. eth0 or br0

 

A new field Fixed IP address (optional) appears and allows you to assign a fixed address

  • Author
32 minutes ago, bonienl said:

 

Change Network Type of a container to a custom network, e.g. eth0 or br0

 

A new field Fixed IP address (optional) appears and allows you to assign a fixed address

Now that is slick!

1 hour ago, bonienl said:

 

Change Network Type of a container to a custom network, e.g. eth0 or br0

 

A new field Fixed IP address (optional) appears and allows you to assign a fixed address

 

I don't get this option. Only "None", "Bridge" or "Host" (basically the same as before). Will the "Custom" option only show under specific conditions?

Did you stop the container before trying.

 

Kevin

16 minutes ago, billington.mark said:

 

I don't get this option. Only "None", "Bridge" or "Host" (basically the same as before). Will the "Custom" option only show under specific conditions?

 

1 minute ago, digitalfixer said:

Did you stop the container before trying.

 

Kevin

 

 

I have indeed. I also only get  "None", "Bridge" or "Host" as network options on new containers as well.

1 minute ago, billington.mark said:

 

I have indeed. I also only get  "None", "Bridge" or "Host" as network options on new containers as well.

 

It definitely works, I just tried it on one of my containers and br0 was at the bottom of the list.

The only other thing that comes to mind is, do you bridging enabled in network settings.

If that doesn't fix it then one of the more knowledgable people will have the answer I'm sure.

 

Kevin

1 minute ago, digitalfixer said:

 

It definitely works, I just tried it on one of my containers and br0 was at the bottom of the list.

The only other thing that comes to mind is, do you bridging enabled in network settings.

If that doesn't fix it then one of the more knowledgable people will have the answer I'm sure.

 

Kevin

 

Bridging is enabled and br0 is definitely available. (im posting from a VM using that bridge!) 

 

8 minutes ago, billington.mark said:

 

Bridging is enabled and br0 is definitely available. (im posting from a VM using that bridge!) 

 

 

br0 must have an IP address either static or by DHCP

  • Author
36 minutes ago, digitalfixer said:

Did you stop the container before trying.

 

Kevin

 

I did this without stopping the docker container.

42 minutes ago, digitalfixer said:

Did you stop the container before trying.

 

Kevin

 

Custom networks are only added when the Docker service itself is started. Stopping and starting a container has no effect.

 

37 minutes ago, bonienl said:

 

br0 must have an IP address either static or by DHCP

 

FIXED.

Restarted the docker service via the GUI and now i have the option. 

 

Only thing i can think is that because im running my router (pfsense) as a vm, br0 has no IP assigned when the docker service starts and only gets it after my pfsense VM is up and running.

 

 

 

I learn something new every day.

 

Kevin.

Is this done via Macvlan?

44 minutes ago, dlandon said:

How do I get an IPV6 address on a docker without manually assigning one?

 

When the custom network (br0 or eth0) has an IPv6 address assigned then the docker container will get automatically an IPv6 address out of the same subnet. The IPAM functionality of docker will assign the ::1 address as gateway address, you will need to set that address on your router if you want the container to go outside of your LAN.

when i give a docker container an ip (network set to br0), other containers, which are still set to network mode bridge, can't connect to the first one.

 

example:

the plex container is set to ip 192.168.0.20

the plexpy container is set to bride (running on unraid on ip 192.168.0.15).

 

in this case, plexpy can't connect to plex on the set ip.

 

I'm guessing there are some routing-problems.

 

other thing: I've noticed, that everytime i changed something in the container (would possibly happen on an update, too), the container gets a new MAC id. This can lead to loosing port forwarding rules set for that container in the router. (in my case, the computer to forward the port to is selected via MAC and not IP, since the IP could change on DHCP devices)

Edited by Benni-chan

11 minutes ago, Benni-chan said:

when i give a docker container an ip (network set to br0), other containers, which are still set to network mode bridge, can't connect to the first one.

 

example:

the plex container is set to ip 192.168.0.20

the plexpy container is set to bride (running on unraid on ip 192.168.0.15).

 

in this case, plexpy can't connect to plex on the set ip.

 

I'm guessing there are some routing-problems.

 

other thing: I've noticed, that everytime i changed something in the container (would possibly happen on an update, too), the container gets a new MAC id. This can lead to loosing port forwarding rules set for that container in the router. (in my case, the computer to forward the port to is selected via MAC and not IP, since the IP could change on DHCP devices)

For containers to communicate they need to be on the same interface like br0.

On 6/5/2017 at 7:28 AM, bonienl said:

br0 must have an IP address either static or by DHCP

There's a use case for the host not having an IP address on a bridge.  A second nic connecting the wan interface of a firewall docker or vm to the outside world is a good example.

 

Its also useful at times to have a bridge with no host interface.  An example is a test environment where Dockers and/or VMs can talk, with no access to the outside world.  I needed to start a Windows VM with no network access.  Since I couldn't find a way to disable the virtual nic, I created a bridge with no interface, and edited the XML file to access this bridge.

1 hour ago, Porkie said:

For containers to communicate they need to be on the same interface like br0.

Correct Docker treats "bridge" as a single network and containers set up in bridge mode are all in the same network. A container in a custom network, e.g. br0 is a different network to Docker.

 

1 hour ago, aim60 said:

There's a use case for the host not having an IP address on a bridge.  A second nic connecting the wan interface of a firewall docker or vm to the outside world is a good example.

 

Its also useful at times to have a bridge with no host interface.  An example is a test environment where Dockers and/or VMs can talk, with no access to the outside world.  I needed to start a Windows VM with no network access.  Since I couldn't find a way to disable the virtual nic, I created a bridge with no interface, and edited the XML file to access this bridge.

 

The "problem" with interfaces without an IP assignment is that no automatic settings can be propagated to Docker as it is unknown what to assign.

 

1 hour ago, Benni-chan said:

other thing: I've noticed, that everytime i changed something in the container (would possibly happen on an update, too), the container gets a new MAC id. This can lead to loosing port forwarding rules set for that container in the router. (in my case, the computer to forward the port to is selected via MAC and not IP, since the IP could change on DHCP devices)

 

With custom networks you have the possibility to set a fixed IP address for the container. Forwarding rules on your firewall can refer to this IP address.

  • Author
2 minutes ago, bonienl said:

 

With custom networks you have the possibility to set a fixed IP address for the container. Forwarding rules on your firewall can refer to this IP address.

This is exactly what I am doing for ownCloud, MineOS, and Zoneminder dockers so they are accessible from the internet.

Archived

This topic is now archived and is closed to further replies.

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.