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.

Cannot assign static IP address to docker containers

Featured Replies

Hi,

 

"A little knowledge is a dangerous thing" and I am downright deadly with networking. In any case I want to assign static IP addresses to docker containers. But everything I've tried fails. I looked around the forum and everyone else seems to have a subtly different problem to me

 

docker run
  -d
  --name='diyHue'
  --net='br0'
  --ip='192.168.2.110'
  -e TZ="Europe/London"
  -e HOST_OS="Unraid"
  -e HOST_HOSTNAME="Kings-Cross"
  -e HOST_CONTAINERNAME="diyHue"
  -e 'MAC'='bc:5f:f4:cd:c6:19'
  -e 'IP'='192.168.1.4'
  -l net.unraid.docker.managed=dockerman
  -l net.unraid.docker.webui='http://[IP]:[PORT:80]'
  -l net.unraid.docker.icon='https://raw.githubusercontent.com/cheesemarathon/docker-templates/master/images/diyhue.png'
  -p '80:80/tcp'
  -p '443:443/tcp'
  -p '1900:1900/udp'
  -p '2100:2100/udp'
  -v '/mnt/user/appdata/diyHue':'/opt/hue-emulator/config/':'rw' 'diyhue/core:latest'
284e7dc8a8358e50984a4e0a39845eb7fa3aa7cf824113eaf6fb2edc99f074b9
docker: Error response from daemon: Invalid address 192.168.2.110: It does not belong to any of this network's subnets.

 

I have had a scout around and I see that one or two other people have in the past had this kind of issue. I thought perhaps it was because br0 is being used by swag (reverse proxy). In the docker settings it says that "Docker custom network type:" is macvlan. But I am not sure if the two are related. So the snipped output of "docker network inspect br0" is thus

        "Name": "br0",
        "Id": "18e4babe66685e8e01cbd6abdcafd4b0e955f78a0649d372360798c55c5aea65",
        "Created": "2021-10-13T15:37:07.11650494+01:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.18.0.0/16",
                    "Gateway": "172.18.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },

 

I wondered if that is because device is bridge and not macvlan, so I tried to create a new interface

 

docker network create -d macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 -o parent=bond0 macvlan

 

I tried this with both bond0 and eth0 ,both gave similar results

 

docker run
  -d
  --name='diyHue'
  --net='macvlan'
  --ip='192.168.1.59'
  -e TZ="Europe/London"
  -e HOST_OS="Unraid"
  -e HOST_HOSTNAME="Kings-Cross"
  -e HOST_CONTAINERNAME="diyHue"
  -e 'TCP_PORT_80'='80'
  -e 'TCP_PORT_443'='443'
  -e 'UDP_PORT_1900'='1900'
  -e 'UDP_PORT_2100'='2100'
  -e 'MAC'='bc:5f:f4:cd:c6:19'
  -e 'IP'='192.168.1.4'
  -l net.unraid.docker.managed=dockerman
  -l net.unraid.docker.webui='http://[IP]:[PORT:80]'
  -l net.unraid.docker.icon='https://raw.githubusercontent.com/cheesemarathon/docker-templates/master/images/diyhue.png'
  -v '/mnt/user/appdata/diyHue':'/opt/hue-emulator/config/':'rw' 'diyhue/core:latest'
206015123b445e977c86a7d0bb59e00acadffc43d3b52a6f4ab7ae7a2e406823
docker: Error response from daemon: failed to create the macvlan port: device or resource busy.

 

Similar for ipvlan.

 

If anyone can give me a suggestion or point me to another thread , that would be great.

 

Thanks

 

 

  • Author

I solved this issue, it seems i had the wrong parent for the network. I used parent=br0, rather than eth0 or bond0. 

docker network create -d macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 -o parent=br0 macvlan

TBH, I don't understand why that is the right way, no doubt others understand the difference.

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.