Migration from Home Assistant OS to Docker or VM?

I started with HyperV on W10, which worked fine, until my zigbee stick broke (and the new Conbee stick did not support Socat).
So I tried to switch to VirtualBox, but that was very unstable; so I moved to VMWare.

Then I got better hardware for the host, and installed it with Debian. The original thought behind it was to move to core or docker, but i really missed Supervisor.
So i set up a supervisor, but i want to use the machine also for other things, and that doesn’t really go well on a supervised machine.

So I ended up with running a Debian11 machine, with VMWare HAOS.

I also realized that another advantage of running it as Virtual Machine is the ability to take snap shots (which i store on an external NAS).
But since the backups of ha (supervised) are pretty ok, that is not really a requirement :wink:

1 Like

what if you are using the MariaDB add-on for your database? I would assume you’d have to back that up separately and point the HA Container to your MariaDB container?

TBH, I have no idea if the add-ons would still continue to function if you got rid of the supervisor. My guess would be yes but you would likely have a hard time interacting with them with no supervisor.

So you would need to manually re-create any add-ons you use as regular Docker containers instead of add-ons.

1 Like

supervisor doesn’t have addon :thinking:

I used debian supervised installation when I started with ha. I moved to docker compose after my server went out of memory twice in a week.
I find docker compose installation much better because you can setup your containers/addons the way you like, add cpu/memory restrictions with ease. I managed to letsencrypt every container I use and some other services that are not running in docker.
I know that lot of that is possible in other types of installation, but I was really struggling with supervised.
I realized that when I moved to docker compose.
Backups are easy to do. I have a backup inside home assistant but I don’t use it.
Instead I use duplicati web server to backup all containers.
There is a lot of info on docker compose on net and it’s not that hard to run ha in container.

Docker is great and easy to set up at first. I started my HA journey in docker because I thought the flexibility of being able to add other containers would come in handy later on.
But a few months on I am considering moving to HASS OS and dedicating the entire Raspberry Pi to it because there are some important limitations with the docker setup: there are no addons, SkyConnect works but is not fully optimised, still haven’t sorted out letsencrypt, no automatic updates, and most community advice is targeted at OS installs.
Now I would probably not recommend a docker installation to anyone starting out with HA

Let me address some things you wrote because they are not true.

“there are some important limitations with the docker setup: there are no addons,”
Yes, there are addons. This what you call addons are docker containers, but they are incorporated in hass os or debian supervised as addons. And you are not limited by the containers aka addons someone else decide to make official.

“still haven’t sorted out letsencrypt”
This is really easy to do in docker. Just try this.

“no automatic updates”
You can use watchtower to automate your updates. All your docker containers aka addons including home assistant will be updated on new release automatically.

Now about some benefits. Memory/cpu/gpu limits are easy to set up in docker based installation for every container including home assistant. Check how many post there is on this forum about high cpu/memory issues. All those installations are hass os or supervised.

You can provide additional security for each container as they usually runs as root. For me this is work in progress.

The main difference between container based installation and hass os or supervised is in engine, suspension, brakes and gear box. Container based installation has upgraded parts, so to say. :smiley: But on the outside car looks pretty much the same.

3 Likes

Thanks, Daniel. You’re right, it’s not that you can’t do the same things in a HA Docker install (as you hinted it can probably be more flexible; that’s what I thought when I started with HA), but that it usually involves a slightly more convoluted process and you better be more than comfortable with the command line and linux systems.

So it’s all down to ease of use, maybe.

Eg: setting up additional containers for things like Z-Wave JS or Letsencrypt can be done with a couple of clicks in Hass OS via Addons (or at least that’s what I am reading and hoping for when I migrate).

I thought I was comfortable enough with CLI to go with a Docker install and have plenty of the RPi resources left for other things, but it turns out that I wasn’t and this choice added an extra layer of complexity to every new thing I added or every debugging attempt.
I wish someone suggested to me that I start with Hass OS for a few months, learn the system without dealing with any complex installs, then maybe take it to a Docker install for a more advanced setup.

I’m still new to HA and coming from SmartThings I was blown away by the extensive level of detail and customisation that it offers, but at the same time I appreciated certain easy/simplified setups on the ST like the Smart Home Monitor.
So maybe the installation tutorial for HA should make some recommendation as to which is best for whom. Eg: easy GUI setup, perfect for new starters – Hass OS; already familiar with containers and command line and like to get your hands dirty – chose Docker;

I :heart: Home Assistant

1 Like

Well i started with supervised installation and i’m glad I moved to container one. When I move my system to docker containers I realized how much i was struggling with supervised installation.
I don’t say don’t go to hass os, but you will after some time probably realize that there is some problems. They are very hard to solve or you just can’t do it, like memory/cpu usage by containers.
If you plan to migrate your house to home assistant consider something much stronger than pi. Full desktop comp with at least one ssd with 250 gb of ram and 8 gb of ram will be a good starting point.
I don’t say that you can’t do it with pi, but I don’t think it is build for such a thing.

1 Like

Sorry for hijacking, but I’m in this same process and using WinScp to copy the folder /Config from HAOS to the Docker container. I’m getting “Permission denied. Error code 3”. I’m a newbie in linux, but I’ve read that I can change permission and get this done ok. But after this I would like to set the permissions back to the way they was, but that can’t be easy. How are you guys doing this?

Found this in another thread and will try it when I get back home

As others have said, the best option may be to install HAos as a guest, you’ll get the benefits of containers still, and you can restore your backups (I use google drive backup extension).

I’ve considered this, though you’ll probably face a slightly longer power on → ready time.
For pure reliability and resilience I’m using:

  • HAos on a NUC-i3
  • Ryzen-7 NAS running heaps of stuff including ZFS, Frigate

I’ve thought about using just one machine, however since HA runs my zigbee network and many important home functions, I keep the machine dedicated to HA only.

Not everything needs to run in HA or the same machine, e.g. frigate can be very intensive, after trying it on the NUC (11th gen i3) it chewed up to half of the CPU with 7 camera processing so I decided to chuck that on my NAS.

Depending on your needs, you could move HA to a raspberry PI or similar SBC, and use the NUC for a lite homelab.

I’m currently running HA OS in Win10/VM, but I’m planning to move to a dedicated Generic x86-64 PC installation. Even with Ryzen 5 3600 and 64 GB of memory VM often gives me a hard time and causes issues. So as described I’m going to migrate to a dedicated PC/laptop with 10th gen i5, 16GB and 250GB SSD. All that should be more than enough to run HA OS with Zigbee support and a handful of add-ons. There is also an additional benefit of having a large battery so the HA can run for many hours in case of a power outage (not that this happens often).

Now to the problem, I’m facing. I made the full back of the HA, but I’m getting an error while uploading it to the new machine. I know that you can’t migrate between some types of HA installations, but I assumed that this method will work on HA OS. Any advice on how to succeed or maybe there is some sort of workaround, like copying all folders and files from old to the new instance?

@Hubszo What VM engine are you using? VirtualBox?

Just asking as I also had big issues with VirtualBox (very unstable).
But once i switched to VMware Workstation, all my problems where solved :grin:

Just as a side note,
I also wanted to move from W10/VMware to a dedicated machine, but i didn’t want to give up Supervised. I didn’t want to spin up another machine, so i went for Debian 10 supervised.
But i rather quickly found out i couldn’t use the machine for anything else anymore.

So installed my VmWare workstation again (also happens to run on Debian), and all runs smooth again ever since, only difference is the host is now Debian instead of W10.
The VM uses 2 cores and 4Gb ram, and takes tops 10% cpu time of the host (normally around 1-2%).

The only downside is that VMWare workstation is a bit harder to configure, but once it runs, it runs :thinking:

Thanks for the reply and some suggestions. I’m indeed using VirtualBox which is the main reason for the migration. For reasons beyond this discussion, I can’t “abandon” Windows so Debian or any other Linux distro is no go. Also as mentioned I have a pretty decent laptop collecting dust so I have no problems running additional PC just for HA. I understand that different people will favor a different solution - actually, for the test purpose, I have a 3rd PC running Proxomo and HA :slight_smile:
As of now, it seems to me that the bare metal/generic x86-64 is the most elegant solution and I found it very frustrating that you can’t in an easy way migrate your setup and data.

It is possible to convert VirtualBox to VMWare :grin:

I, along with a lot of others, have used the supervised install method of running HA for a long time. It’s as close to using home assistant OS as you can get. In the past you could migrate from HA OS to a supervised install without issue. Here’s and old post of someone talking about doing it. The guest VM has be be debian bullseye so that HA doesn’t complain, but your host machine can be windows, macos, linux, whatever. If you haven’t tried a supervised install I’d give it a try.

I appreciate your feedback and some valuable tips, but unfortunately, this still didn’t answer the main subject of my question and this thread - migration. I understand the primary purpose of HA full backup, however, the world went beyond simple restore functionality long ago. Take mobile phones for example. With full backup, you can easily migrate from one device to another. Granted, when changing device manufacturer you will have to tweak a couple of things, provide credentials to your apps again, etc. but if you stick with the same brand the entire process is pretty straightforward and beginner friendly.

I would love to see your compose.yaml

Sure. But be aware that I tend to experiment with settings a lot and maybe my config is not the best one out there. I will post just a part of it as I have a lot of containers, but for some basic setup this should be enough.
docker-compose.yml file

services:
  portainer:
    container_name: portainer
    image: portainer/portainer-ce:latest
    restart: always
    ports:
      - "9000:9000/tcp"
      - "9443:9443/tcp"
    environment:
      - TZ=Europe/Zagreb
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock
      - /opt/portainer:/data
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    devices:
      - /dev/serial/by-id/usb-Silicon_Labs_slae.sh_cc2652rb_stick_-_slaesh_s_iot_stuff_00_12_4B_00_23_90_C7_F4-if00-port0
    environment:
      - TZ=Europe/Zagreb
    cap_add:
      - NET_ADMIN
    security_opt:  
      - no-new-privileges
    volumes:
      - /opt/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
      - /run/dbus:/run/dbus:ro
      - /var/run/docker.sock:/var/run/docker.sock
    depends_on:
      - mosquitto
      - influxdb
    stop_grace_period: 60s
    restart: always
    network_mode: host
### zigbee2mqtt
  zigbee2mqtt:
    container_name: zigbee2mqtt
    image: koenkk/zigbee2mqtt:latest
    restart: unless-stopped
    volumes:
      - ./zigbee2mqtt/data:/app/data
      - /run/udev:/run/udev:ro
    ports:
      - 8090:8080
    environment:
      - TZ=Europe/Zagreb
    devices:
      # Make sure this matched your adapter location
      - /dev/serial/by-id/usb-Silicon_Labs_slae.sh_cc2652rb_stick_-_slaesh_s_iot_stuff_00_12_4B_00_23_90_C7_F4-if00-port0:/dev/ttyACM0
      # user and group settings
    group_add:
      - dialout
    user: 1001:1001
    depends_on:
      - mosquitto
### esphome
  esphome:
    container_name: esphome
    image: esphome/esphome
    environment:
      - ESPHOME_DASHBOARD_USE_PING=true
    volumes:
      - /opt/esphome/config:/config
      - /etc/localtime:/etc/localtime:ro
    depends_on:
      - homeassistant
    restart: always
    privileged: true
    network_mode: host
### frigate
  frigate:
    container_name: frigate
    privileged: false 
    restart: unless-stopped
    image: ghcr.io/blakeblackshear/frigate:stable-tensorrt
    runtime: nvidia
    shm_size: "128mb" # update for your cameras based on calculation above
    devices:
      - /dev/bus/usb:/dev/bus/usb # passes the USB Coral, needs to be modified for other versions
      - /dev/nvidia0
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /opt/frigate/storage:/media
      - /opt/go2rtc:/config:rw
      - /opt/frigate/config/model_cache/tensorrt:/config/model_cache/tensorrt
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000"
      - "1935:1935" # RTMP feeds
    environment:
      TZ: Europe/Zagreb
      FRIGATE_RTSP_PASSWORD: "_your_password"
      NVIDIA_VISIBLE_DEVICES: all
      NVIDIA_DRIVER_CAPABILITIES: all
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              capabilities: [gpu]
    cap_add:
      - NET_ADMIN
### glances
  glances:
    container_name: glances
    image: nicolargo/glances:3.4.0.5
    restart: always
    pid: host
    network_mode: host
    environment:
      - TZ=Europe/Zagreb
      - GLANCES_OPT=-C /etc/glances.conf -w
      - PUID=1001
      - PGID=8123
      - UMASK=007
      - PACKAGES=iputils
    cap_drop: 
      - ALL
    cap_add:
      - CHOWN
      - SETUID
      - SETGID
      - NET_ADMIN
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /run/user/1001/podman/podman.sock:/run/user/1001/podman/podman.sock
      - /opt/glances/conf/glances.conf:/etc/glances.conf
      - /etc/os-release:/etc/os-release:ro
    healthcheck: 
      test: curl --fail http://192.168.8.40:61208/ || exit 1 
      interval: 15s
      timeout: 1m
      retries: 2
### samba
  samba:
    image: crazymax/samba
    container_name: samba
    network_mode: host
    volumes:
      - "/opt/samba/data:/data"
      - "/opt/homeassistant:/opt/homeassistant/"
      - "/opt:/opt/"
      - "/home/daniel:/home/daniel/"
    environment:
      - "BROWSABLE=yes"
      - "SAMBA_WORKGROUP=HASSIO"
    restart: always  
    cap_add:
      - NET_ADMIN
      - NET_RAW
### mosquitto
  mosquitto:
    image: eclipse-mosquitto:latest
    container_name: mosquitto
    environment:
      - TZ=Europe/Zagreb
      - PUID=1883
      - PGID=1883
      - UMASK=007
      - PACKAGES=iputils
    cap_drop: 
      - ALL
    cap_add:
      - CHOWN
      - SETUID
      - SETGID
      - NET_ADMIN
    security_opt:  
      - no-new-privileges
    volumes:
      - /opt/mosquitto:/mosquitto
      - /opt/mosquitto/config:/mosquitto/config:rw
      - /opt/mosquitto/data:/mosquitto/data
      - /opt/mosquitto/log:/mosquitto/log
    ports:
      - 1883:1883
      - 9001:9001   
    restart: unless-stopped
### go2rtc
  go2rtc:
    container_name: go2rtc
    image: alexxit/go2rtc:master-hardware
    network_mode: host
    privileged: true
    environment:
      - TZ=Europe/Zagreb
      - PUID=65534
      - PGID=65534
      - UMASK=007
      - PACKAGES=iputils
    cap_drop: 
      - ALL
    cap_add:
      - CHOWN
      - SETUID
      - SETGID
    healthcheck: 
      test: curl --fail http://192.168.8.40:1984/ || exit 1 
      interval: 15s
      timeout: 1m
      retries: 2
    volumes:
      - /opt/go2rtc:/config
    restart: unless-stopped
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]