Docker compose issues with WOL and "network_mode: host"

I’m having trouble with my docker-compose file. I want to use WOL which I believe needs te container to urn with network_mode host. Below is my compose file. But it fails with the error:

ERROR: The Compose file ‘./docker-compose.yml’ is invalid because:
Unsupported config option for home-assistant: ‘network_mode’

I’ve tried it with quotes around host and no quotes - but neither work. Works fine if I take it out, but then WoL doesn’t work. Any ideas what I’m doing wrong?

home-assistant:
    container_name: home-assistant
    network_mode: host 
    image: "homeassistant/home-assistant"
    ports: 
        - "8123:8123"
    volumes: 
        - /path/home-assistant:/config
    restart: unless-stopped

Remove the ports: section, you can’t use it with network_mode: host. Using host network mode will already open 8123 on the host.

1 Like

FWIW I still have ports defined in mine but i also use network_mode: host. It’s a vestige of when I wasn’t running in host mode and I just keep it in case I go back. I run docker-compose 2 so maybe that’s the difference.

Ahhh. Thanks very much.

Spoke too soon. Just tried the below and got the same error

home-assistant:
    container_name: home-assistant
    network_mode: host 
    image: "homeassistant/home-assistant"
    volumes: 
        - /home/pi/docker/home-assistant:/config
    restart: unless-stopped
$ docker-compose up -d
ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for home-assistant: 'network_mode'

this is mine

version: '3'
services: 
  hass:
    image: homeassistant/home-assistant:dev
    container_name: "hass"
    restart: always
    volumes:
      - /mnt/docker/hass:/config
    network_mode: "host"