Migrating to HA Core on Docker (on Mac OS)

I’ve been running HA OS on a RPi4b 2gb for a little more than a year and it has been good to me. During this time I had 1 sd card failure and have since moved everything to an SSD. It’s powered by poe and the switch that it is on has UPS backup.

Recently, I’ve been experimenting with HA on Docker for Mac and rather than restoring the current setup to it, I’ve been slowly migrating the different integrations over bit by bit. I gotta say, I’m fairly pleased (and proud of myself) with the progress of learning how to use Docker and things up with docker-compose. Much of all my add-ons that aren’t part of the unsupervised HA install are ~75% in place.

However, I’ve been a little turned off by the latest few setbacks which I can’t seem to work around. I’m not sure if I’m hitting the extent of being able to do this through docker on a Mac. Maybe it would work out better if it weren’t on the Mac OS and the reason I think maybe is that the “host” network mode is not available on Windows/Mac?

The two latest integrations that don’t seem to work thus far is AlarmDecoder and Sonos.

  • For alarm decoder, it seems I am able to connect to the host during the integration and it is able to allow me to configure alarm setting, door contacts and motion sensors. However, nothing is responsive: when walking in front of the sensors and opening doors, nothing updates. The “panel” card just stays “unknown” all the time. The integration also takes a VERY long time to “complete” after each restart. I don’t actually think it even finishes, but there are many lines of code in the log that seem to suggest that it has stopped responding correctly.

  • Sonos is unable to auto-discover even though the Mac is on the same vlan as the Sonos speakers. It actually isn’t just the Sonos speakers that doesn’t auto discover, but there are no auto discovered integrations at all. I didn’t mind manually setting up all the other integrations, but this problem with Sonos doesn’t seem to work even when manually pointing to all my speakers (which all have static IPs). When adding them all in manually, lots of errors pop up in the log.

  • I dread the day I have to deal with NGINX + DuckDN. Because of what I think the crux of the problem is, network mode, I feel that working through this would likely be a complete disaster. Who knows what else is waiting for me down the road with whatever integrations/add-ons.

If anyone has general comments or specific fixes for the above integrations, great, but I guess I’m trying to ask is, is this sort of configuration generally not used because there is inherently something amiss with the docker configuration on Windows/Mac?

The motivation for setting it up this way is to 1) repurpose older hardware and 2) being a laptop, it has inherent “battery backup” 3) the rpi4 setup for some odd reason for these past couple months exhibits very high memory usage and is causing some issues and so I thought I’d give this a go.

I think I can foresee suggestions to run docker some other way, like linux on the RPi4b, etc. and I’m honestly not very inclined to do so because my ability with Linux is horrible – I’ve tried over the years but to me it just seems way over my head. Experimenting with Docker was already a pretty big leap for me :slight_smile:

Thoughts?

Likely. Did you set your container network in “host” mode?
If not, docker is running in its own vlan

Docker on Mac doesn’t support host mode networking, which is why Docker on Mac isn’t supported.

1 Like

Yes, that’s correct. Without having proper support of host network mode on Mac/Windows, I think that’s probably why I’m running into these weird issues. What you said @koying, makes a lot of sense now … without host network mode, I’ve been seeing a lot of IPs referenced in the 172.XX.XX.XX range.

For reference, everything I’ve been running works perfectly fine with this docker-compose below. Nothing complex, but happy that everything worked … up to this point. Just too bad that things started to get weird …

version: "3.9"
services:


  homeassistant:
    container_name: home-assistant
    image: homeassistant/home-assistant:stable
    volumes:
      - ./homeassistant-config:/config
      - /etc/localtime:/etc/localtime:ro
    ports:
    - "8123:8123"
    restart: unless-stopped
    depends_on:
      - mariadb
      - mqtt
      - configurator


  configurator:
    container_name: configurator
    image: causticlab/hass-configurator-docker:latest
    restart: always
    ports:
      - "3218:3218/tcp"
    volumes:     
      - ./homeassistant-config:/config   # map this volume to your hassio config directory
    environment:
      - HC_BASEPATH=/config

  mariadb:
    container_name: mariadb
    image: mariadb:latest
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: "${MARIADB_MYSQL_ROOT_PWD}"
      MYSQL_DATABASE: "${MARIADB_MYSQL_DATABASE}"
      MYSQL_USER: "${MARIADB_MYSQL_USER}"
      MYSQL_PASSWORD: "${MARIADB_MYSQL_PWD}"
    volumes:
      - ./mariadb:/var/lib/mysql
    ports:
      - "3306:3306"

  mqtt:
    container_name: mqtt
    image: eclipse-mosquitto:latest
    ports:
      - "1883:1883"
      - "9001:9001"
    restart: unless-stopped
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./mosquitto/config:/mosquitto/config
      - ./mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf
      - ./mosquitto/config/passwd:/mosquitto/config/passwd
      - ./mosquitto/data:/mosquitto/data
      - ./mosquitto/log:/mosquitto/log

  esphome:
    container_name: esphome
    image: esphome/esphome
    ports:
      - "6052:6052"
    restart: unless-stopped
    volumes: 
      - ./esphome:/config
      - /etc/localtime:/etc/localtime:ro
    environment:
      ESPHOME_DASHBOARD_USE_PING: "true"
    # devices:
    #   - /dev/ttyUSB0:/dev/ttyUSB0
    #   - /dev/sda:/dev/xvda:rwm

  adguard:
    container_name: adguard
    image: adguard/adguardhome
    ports:
      - 53:53/tcp
      - 53:53/udp
      - 784:784/udp
      - 853:853/tcp
      - 3000:3000/tcp
      - 83:80/tcp
    restart: unless-stopped
    volumes: 
      - ./adguard/work:/opt/adguardhome/work
      - ./adguard/conf:/opt/adguardhome/conf

Edit: sorry I think I’m confusing myself, please excuse this post.

Instead of that, take a look at my Digital Ocean-based approach using certbot / Let’s Encrypt with a DNS challenge. It’s using Podman and not Docker, and you won’t have systemd to schedule things, but the basics should be similar: Work in progress: configuration for running a Home Assistant in containers with systemd and podman on Fedora IoT

I spent a good chunk of time reading through your opening post over there and I gotta say, everything went over my head. I mean EVERYTHING. It is clearly much beyond my comprehension :slight_smile:

Edit: as I’m scrolling through all the posts further down, i can see what I can try to adapt but I’ll definitely need more time … haha

I intend at some point to break it down and make it a lot simpler. It’s just… time :slight_smile: