homebridge / docker-homebridge

Homebridge Docker. HomeKit support for the impatient using Docker on x86_64, Raspberry Pi (armhf) and ARM64. Includes ffmpeg + libfdk-aac.
https://hub.docker.com/r/homebridge/homebridge/
GNU General Public License v3.0
2.57k stars 240 forks source link

Web UI not reachable in bridged mode. #379

Closed j-kk closed 2 years ago

j-kk commented 3 years ago

Describe Your Problem: There is no access to the Homebridge UI without network mode set to host, despite all other Homebridge features can be supplied with macvlan.

I've created a macvlan network, so "smart stuff" can recognize homebridge. However after I replaced the network mode host option with networks and port bindings, there is no access to the web UI. It is only accessible within bridged network from other containers. Any port bindings to the UI are ignored.

Logs:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 10-adduser: executing...

-------------------------------------
GID/UID
-------------------------------------
User uid:    1000
User gid:    1000
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-set-timezone: executing...
Set system timezone to ABC/XYZ.
[cont-init.d] 20-set-timezone: exited 0.
[cont-init.d] 30-packages: executing...
[cont-init.d] 30-packages: exited 0.
[cont-init.d] 40-dbus-avahi: executing...
[cont-init.d] 40-dbus-avahi: exited 0.
[cont-init.d] 45-user-data: executing...
[cont-init.d] 45-user-data: exited 0.
[cont-init.d] 50-plugins: executing...

    Thank you for using the oznu/homebridge docker image!

  If you find this project useful please STAR it on GitHub:

         https://github.com/oznu/docker-homebridge

                Or donate to the project:

            https://github.com/sponsors/oznu
                  https://paypal.me/oznu

Homebridge: Installing plugins...
up to date in 3.111s
up to date in 3.461s
[cont-init.d] 50-plugins: exited 0.
[cont-init.d] 55-config-ui: executing...
Enabling homebridge-config-ui-x...
[cont-init.d] 55-config-ui: exited 0.
[cont-init.d] done.
[services.d] starting services
Starting cron

  If you find this project useful please STAR it on GitHub:

         https://github.com/oznu/docker-homebridge

                Or donate to the project:

            https://github.com/sponsors/oznu
                  https://paypal.me/oznu

[services.d] done.
[7/24/2021, 9:08:29 PM] [HB Supervisor] Homebridge Storage Path: /homebridge
[7/24/2021, 9:08:29 PM] [HB Supervisor] Homebridge Config Path: /homebridge/config.json
[7/24/2021, 9:08:29 PM] [HB Supervisor] Logging to /homebridge/homebridge.log
[7/24/2021, 9:08:29 PM] [HB Supervisor] OS: Linux 5.10.17-v7+ arm
[7/24/2021, 9:08:29 PM] [HB Supervisor] Node.js v14.17.3 /usr/local/bin/node
[7/24/2021, 9:08:29 PM] [HB Supervisor] Homebridge Path: /usr/local/lib/node_modules/homebridge/bin/homebridge
[7/24/2021, 9:08:29 PM] [HB Supervisor] UI Path: /usr/local/lib/node_modules/homebridge-config-ui-x/dist/bin/standalone.js
[7/24/2021, 9:08:37 PM] [Homebridge UI] Homebridge Config UI X v4.41.1 is listening on 0.0.0.0 port 8581
[7/24/2021, 9:08:38 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /homebridge/node_modules
[7/24/2021, 9:08:38 PM] [HB Supervisor] Started Homebridge v1.3.4 with PID: 415
Initializing HAP-NodeJS v0.9.4...
[7/24/2021, 9:08:40 PM] Loaded config.json with 0 accessories and 3 platforms.
[7/24/2021, 9:08:41 PM] Loaded 2 cached accessories from cachedAccessories.
[7/24/2021, 9:08:41 PM] ---
[7/24/2021, 9:08:42 PM] Loaded plugin: homebridge-dummy@0.5.0
[7/24/2021, 9:08:42 PM] Registering accessory 'homebridge-dummy.DummySwitch'
[7/24/2021, 9:08:42 PM] ---
[7/24/2021, 9:08:43 PM] Loaded plugin: homebridge-smogomierz@1.3.1
[7/24/2021, 9:08:43 PM] Registering accessory 'homebridge-smogomierz.Smogomierz'
[7/24/2021, 9:08:43 PM] ---
[7/24/2021, 9:08:43 PM] Loaded plugin: homebridge-tapo@1.1.1
[7/24/2021, 9:08:43 PM] Registering platform 'homebridge-tapo.TapoP100'
[7/24/2021, 9:08:43 PM] ---
[7/24/2021, 9:08:43 PM] Loaded plugin: homebridge-tplink-smarthome@6.4.0
[7/24/2021, 9:08:43 PM] Registering platform 'homebridge-tplink-smarthome.TplinkSmarthome'
[7/24/2021, 9:08:43 PM] ---
[7/24/2021, 9:08:43 PM] Loaded plugin: homebridge-config-ui-x@4.41.1
[7/24/2021, 9:08:43 PM] Registering platform 'homebridge-config-ui-x.config'
[7/24/2021, 9:08:43 PM] ---
[7/24/2021, 9:08:43 PM] Loading 3 platforms...
[7/24/2021, 9:08:43 PM] [Config] Initializing config platform...
[7/24/2021, 9:08:43 PM] [Config] Running in Service Mode
[7/24/2021, 9:08:43 PM] [TplinkSmarthome] Initializing TplinkSmarthome platform...
[7/24/2021, 9:08:43 PM] [TplinkSmarthome] homebridge-tplink-smarthome v6.4.0, node v14.17.3, homebridge v1.3.4, api v2.7
[7/24/2021, 9:08:44 PM] [Tapo Smart Platform] Initializing TapoP100 platform...
[7/24/2021, 9:08:44 PM] [TplinkSmarthome] Configuring cached accessory: [Blu] UUID: ABC deviceId: XYZ
[7/24/2021, 9:08:44 PM] [Tapo Smart Platform] Loading accessory from cache: 192.168.11.101
[7/24/2021, 9:08:44 PM] [Tapo Smart Platform] Restoring existing accessory from cache: 192.168.11.101
Preparing Advertiser for 'Homebridge C578 A95D' using bonjour-hap backend!
Setup Payload:
X-HM://00248MJ27WI7S
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐
    │ XYZ │
    └────────────┘

Starting to advertise 'Homebridge C578 A95D' using bonjour-hap backend!
[7/24/2021, 9:08:44 PM] Homebridge v1.3.4 (Homebridge C578) is running on port 51819.
[7/24/2021, 9:08:45 PM] [TplinkSmarthome] New Device Online: [Blu] plug [ABC] 192.168.11.31 9999
[7/24/2021, 9:08:45 PM] [TplinkSmarthome] Adding: [Blu] plug [ABC]

Docker Start Command: Using docker-compose with multiple containers, stripped only to homebridge and networks setup.

version: "3"
services:

  homebridge:
    image: oznu/homebridge:raspberry-pi
    restart: unless-stopped
    container_name: homebridge
    volumes:
      - ./homebridge/config:/homebridge
    environment:
      - PGID=1000
      - PUID=1000
      - HOMEBRIDGE_CONFIG_UI=1
      - HOMEBRIDGE_CONFIG_UI_PORT=8581

    ports: 
      - "8581:8581"
    networks: 
      inner:
      dockervlan:

networks: 
  inner:
    driver: bridge
  # Used by homebridge to expose bonjours, homekit services etc.
  dockervlan:
    driver: macvlan
    driver_opts:
      parent: eth0
    ipam:
      config:
        - subnet: "192.168.11.0/24"
          gateway: "192.168.11.1"

Homebridge Config:

Show your homebridge config.json here

Environment:

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stoelwinder commented 3 years ago

I think I'm facing the same issue. Bridged mode doesnt give external access at all. Firewall is disabled

seanbranam commented 2 years ago

Same issue. Host or Bridge, IP never shows up on the docker screen for the app. Does this need to be configured within the docker?

stoelwinder commented 2 years ago

Same issue. Host or Bridge, IP never shows up on the docker screen for the app. Does this need to be configured within the docker?

Sorry for the tardy response. I managed to get it working by doing the following:

Under the Instance Edit, go to Port Settings and create a port and forward traffic to the port in the instance eg: Local Port: 8088, Container Port: 8581 (or whatever is in your config)

seanbranam commented 2 years ago

I appreciate your reply, but I think you might be thinking of something else. Within Unraid, the container already has a configuration.

Container Variable: HOMEBRIDGE_CONFIG_UI_PORT

But when the container is turned on, unraid doesn't show that it ever was assigned the IP and port. Every other contraire works except this one.

I suspect something is wrong in the packaging of this container for Unraid.

jspv commented 2 years ago

For others who are using macvlan, I am successfully running homebridge using macvlan networking which provide a full MAC address and IP address to the container (the best way to do this IMO); everything is working, including the GUI. Below is what I'm doing (doing it directly in this case and not with compose, but compose would work too)

  1. define your macvlan network: sudo docker network create -d macvlan --subnet 192.168.1.0/24 --gateway 192.168.1.1 -o parent=eth0 mynetworkname - obviously replace the values with your appropriate subnet, gateway and network device.
  2. When defining your container: specify your new macvlan network and define the IP address you want the container to use. For example (this is my exact call with only IP ranges and network name changed):
    sudo docker run \
    --detach \
    --name=homebridge \
    --restart=unless-stopped \
    --net=mynetworkname \
    --ip=192.168.1.9 \
    -e TZ=America/New_York \
    -e HOMEBRIDGE_CONFIG_UI=1 \
    -e HOMEBRIDGE_CONFIG_UI_PORT=8581 \
    -e PGID=996 \
    -e PUID=996 \
    -e DSM_HOSTNAME=homebridge \
    --volume /mnt/dvr/homebridge:/homebridge \
    oznu/homebridge:ubuntu

The GUI is now available at the IP address I assigned and the port I assigned.

(note: above I also create a homebridge service account 996:996, this has no impact on the networking.)

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.