How to run HomeAssistant on Docker, on its own network instead of the host network?

You‘re right, in the container they run on different ports. However, Traefik exposes all services on port 80 and forwards the requests according to a subpath.
Example:

<IP>:80/grafana/…
<IP>:80/piwigo/…
<IP>:80/api/…

Now the hue emulation of homeassistant would also need port 80 and I‘m pretty sure this can only work on a separate IP.
However, I‘ve got it to work with MacVlan, but included it directly into my docker-compose file:
In the homeassistant-service:

    networks:
      homeassistant-network:
        ipv4_address: 192.168.1.11

And the network config:

networks:
  homeassistant-network
    driver: macvlan
    driver_opts:
      parent: eth0
    ipam:
      config:
        - subnet: 192.168.1.0/24
          gateway: 192.168.1.1 #Fritzbox-IP
          ip_range: 192.168.1.11/32 #Homeassistant-IP
2 Likes