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 241 forks source link

Docker Compose network_mode = host does not open ports #502

Closed mazshar closed 1 year ago

mazshar commented 1 year ago

Current Situation

I'm running an Ubuntu 22.04 LTS server with various docker containers using docker-compose. When I set network_mode=host and check with docker ps there are no open ports. However if I change the network mode to bridge and expose the ports, they appear.

CONTAINER ID   IMAGE                               COMMAND                  CREATED          STATUS                          PORTS                                                                                                                                                                                                                                                                                                                                                                                                NAMES
6c7d7ff2eab7   oznu/homebridge:2022-11-14          "/init"                  57 seconds ago   Up 45 seconds                                                                                                                                                                                                                                                                                                                                                                                                                        homebridge

Docker version 23.0.1, build a5ee5b1 Docker Compose version v2.16.0

Docker Config

homebridge:
    container_name: homebridge
    image: oznu/homebridge:2022-11-14
    restart: unless-stopped
    network_mode: host
    volumes:
      - /config/homebridge:/homebridge
    logging:
      driver: json-file
      options:
        max-size: "10mb"
        max-file: "1"
    environment:
      - PGID=1001
      - PUID=1001
      - HOMEBRIDGE_CONFIG_UI=1
      - HOMEBRIDGE_CONFIG_UI_PORT=8581

Logs

No response

Host Operating System

Ubuntu / Debian (or a variant)

Host Architecture

x86_64 / amd64

riteesh3 commented 5 months ago

Hello,

I am trying to setup homebridge on my device and I am facing this exact issue. Were you able to open ports to container? If yes, How?

NorthernMan54 commented 5 months ago

What OS are you ?

https://github.com/homebridge/docker-homebridge?tab=readme-ov-file#compatibility

riteesh3 commented 5 months ago

Thanks for replying.

But I was able to solve the issue by changing network_mode to 'bridge' from 'host'. This helped me to open the container ports to my local system port.