# Homey Self-Hosted Server with Docker on Linux | Megathread

**URL:** <https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441>\
**Category:** Homey Self-Hosted Server\
**Created:** [December 5, 2025, 2:16pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441 "2025-12-05T14:16:53Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![Mitchell\_Homey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mitchell_homey/32/125728_2.png) [@Mitchell\_Homey](https://community.homey.app/u/Mitchell_Homey)\
**Post date:** [March 23, 2026, 10:53pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/41 "2026-03-23T22:53:12Z")

</div>

I have bought a mini PC and installed Ubuntu and Docker to run Homey SHS. I have one major problem: if I follow the instructions on [https://support.homey.app/hc/en-us/articles/24010537261980-How-to-install-Homey-Self-Hosted-Server-with-Docker-on-Linux](https://support.homey.app/hc/en-us/articles/24010537261980-How-to-install-Homey-Self-Hosted-Server-with-Docker-on-Linux) But with network\_mode: host, I dont get a port. I see my container in Docker, with no port(s) so it won’t work. If I remove and force the port with something like this:  
–name homey-shs  
–restart=always  
-p 4859:4859  
-p 4860:4860

My Homey SHS works and I can add the IP / setup the android app and there’s a lot that works: adding Hue lights, installing apps and importing devices etc. There are als some things that will not work: adding the Homey Bridge or finding Google Cast (Chromecasts, Nest Hubs) devices for example… I cannot get it working with network\_mode: host and not everything works without network\_mode: host. It’s driving me crazy! Anyone has idea’s? Would be apprenticed!

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [March 23, 2026, 11:05pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/42 "2026-03-23T23:05:53Z")

</div>

Is it possible to test the alternative  
[https://support.homey.app/hc/en-us/articles/23975096785948-How-to-install-Homey-Self-Hosted-Server-on-Linux](https://support.homey.app/hc/en-us/articles/23975096785948-How-to-install-Homey-Self-Hosted-Server-on-Linux)

I used it on a Debian host, and HSHS ran w/o network issues.

---

<div class="post-metadata">

**Author:** ![Mitchell\_Homey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mitchell_homey/32/125728_2.png) [@Mitchell\_Homey](https://community.homey.app/u/Mitchell_Homey)\
**Post date:** [March 24, 2026, 2:14pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/43 "2026-03-24T14:14:13Z")

</div>

Hi thanks for your reply. But this is basically the same right? Both use Docker, one with a yaml/docker compose and one directly. But I have the same issue regarding network\_mode: host

---

<div class="post-metadata">

**Author:** ![Gerritv](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/gerritv/32/121892_2.png) [@Gerritv](https://community.homey.app/u/Gerritv)\
**Post date:** [April 11, 2026, 12:33pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/44 "2026-04-11T12:33:36Z")

</div>

I run SHS on a Lenovo SFF, Ubunutu server 24.0.4 LTS

My compose file:

```auto
services:
  homey-shs:
    image: ghcr.io/athombv/homey-shs:latest
    container_name: homey-shs
    restart: unless-stopped
    network_mode: host
    privileged: true
    volumes:
      - ~/.homey-shs:/homey/user

```

uname -a  
Linux homey-shs 6.17.0-14-generic #14-Ubuntu SMP PREEMPT\_DYNAMIC Fri Jan 9 17:01:16 UTC 2026 x86\_64 GNU/Linux

Docker version 29.3.0

Are there any hints in th elog output when the container starts up? (docker run without the -d will spew it all to the terminal screen). Also logs are in the .homey-shs directory.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [April 11, 2026, 2:42pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/45 "2026-04-11T14:42:44Z")

</div>

Not sure what you mean exactly, but you can view the logs by executing this command (in a second terminal):

```auto
$ docker compose -f homey-shs.yml logs --follow

```

As per KB article [https://support.homey.app/hc/en-us/articles/24010537261980-How-to-install-Homey-Self-Hosted-Server-with-Docker-on-Linux](https://support.homey.app/hc/en-us/articles/24010537261980-How-to-install-Homey-Self-Hosted-Server-with-Docker-on-Linux)

 ![Screenshot_20260411_164110_Ecosia](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/f/9f803dd99aef37ab5b62d79d6d277aa3249973a5.jpeg)

---

<div class="post-metadata">

**Author:** ![Anoniemand](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/anoniemand/32/120697_2.png) [@Anoniemand](https://community.homey.app/u/Anoniemand)\
**Post date:** [April 11, 2026, 2:51pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/46 "2026-04-11T14:51:25Z")

</div>

No sure what you mean either.

To verify if docker container is running as expected i usually use `docker ps`. It will show each docker container status (and some other details).

To get docker logs from a container `docker logs <container name>`.

---

<div class="post-metadata">

**Author:** ![Gerritv](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/gerritv/32/121892_2.png) [@Gerritv](https://community.homey.app/u/Gerritv)\
**Post date:** [April 11, 2026, 3:10pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/47 "2026-04-11T15:10:49Z")

</div>

yes, better choices to use ‘docker logs’ if the container is already running. (–follow is aslo a good option to keep watching) But that only show recent stuff.

The full log file is actually also visible in ~/.home-shs/logs if you want to root around finding specific things.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [April 11, 2026, 3:27pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/48 "2026-04-11T15:27:13Z")

</div>

> [@Gerritv](#):
>
> But that only show recent stuff.

True, but it shows everything from the start on when I start that “follow” command prior to the container start.

---

<div class="post-metadata">

**Author:** ![Domenico\_Etere](https://avatars.discourse-cdn.com/v4/letter/d/f19dbf/32.png) [@Domenico\_Etere](https://community.homey.app/u/Domenico_Etere)\
**Post date:** [April 13, 2026, 6:35pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/49 "2026-04-13T18:35:04Z")

</div>

I have a similar issue. From my HPE 2019 I can’t reach SHS by using Homesh controller APP on my HPE2019. Viceversa it is working fine: from my SHS i can reach HPE2019 by using Homesh controller APP on my SHS. Did you have any suggestion?

The error that rises on my HPE2019 side is “connect ECONNREFUSED :80”, it happens when I try to connect to the Homesh Satellite APP on SHS.

Please could anyone help me?

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [April 13, 2026, 6:42pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/50 "2026-04-13T18:42:05Z")

</div>

I’d first try the HomeyLink app instead.

Otherwise, you probably have to change the default port temporary from 4859 to 80 to see if it connects;  
Make sure there’s no other local web server running on port 80.

---

<div class="post-metadata">

**Author:** ![zm.miska](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/zm.miska/32/120752_2.png) [@zm.miska](https://community.homey.app/u/zm.miska)\
**Post date:** [May 28, 2026, 9:32pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/51 "2026-05-28T21:32:14Z")

</div>

Hi,  
SHS in Docker on TerraMaster F2-223 (TOS 7, Docker Manager): every app crashes immediately on start.

Error from container logs:

CreateClientError: ManagerDrivers.getDrivers is not a function

at SDK.createClient (/app/packages/homey-local/lib/AppProcess/…)

Homey [err][ManagerAppsLocal] Error Starting: App Crashed

Exit Code: 1

SHS itself is healthy — discovery, login, app store browsing all work, trial active. Only the app spawn step fails.

Already tried, none resolved it: restart, rebuild, fresh image pull, full nuclear reinstall (deleted project + image + volume + Athom account instance), HOMEY\_LOCAL\_ADDRESS env var

Anyone seen this ManagerDrivers.getDrivers error

---

<div class="post-metadata">

**Author:** ![DEmsley](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/demsley/32/122138_2.png) [@DEmsley](https://community.homey.app/u/DEmsley)\
**Post date:** [May 31, 2026, 4:02pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/52 "2026-05-31T16:02:54Z")

</div>

Hi All,  
**Just tried to follow the install in docker on Ubuntu.  
I think it is running as I get the blurb that says it is…**

**However the Android App says it has “1 Self Hosted Server found…” at the correct IP address but then timer whirrs and nothing happens. With manual I get “unable to connect to your Self Hosted Server”.**

EDIT - I had started my thread and then realised it was a firewall blocking the port 4859 and 4860.  
I will still post it if this is useful to other newbies.

Dave

If it matters - Server HP box 16Gb RAM, a few Tb of disc space, Ubuntu Server 24.04.4 LTS

---

<div class="post-metadata">

**Author:** ![Ruurd\_van\_der\_Noord](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ruurd_van_der_noord/32/71093_2.png) [@Ruurd\_van\_der\_Noord](https://community.homey.app/u/Ruurd_van_der_Noord)\
**Post date:** [September 29, 2026, 7:21am UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/53 "2026-09-29T07:21:34Z")

</div>

A backup-and-update script that runs flawlessly.  
**It’s not usable as-is** , because it assumes specific mount points and directory layouts.

```auto
#!/usr/bin/env bash
# sudo ./backUpdate_Pi5_SHS.sh
set -Eeuo pipefail

###############################################################################
# CONFIGURATION
###############################################################################

DATE="$(date +%Y%m%d-%H%M%S)"

MOUNT="/mnt/pi5-T7B"
BACKUP_DIR="$MOUNT/Backup4/Pi5_Backup"
INFO_DIR="$BACKUP_DIR/Backup_INFO"
KEEP=31
LOG="/var/log/backup-pi5-opi.log"

USER_NAME="YOUR_USERNAME"
USER_HOME="/home/$USER_NAME"

HOMEY_CONTAINER="homey-shs"
HOMEY_IMAGE="ghcr.io/athombv/homey-shs"
HOMEY_DATA="$USER_HOME/.homey-shs"

DOCKER_DIR="$USER_HOME/homey-shs"
SCRIPTS_DIR="$USER_HOME/scripts"
COMPOSE_DIR="$USER_HOME/homey-shs"

###############################################################################
# LOGGING
###############################################################################

sudo mkdir -p "$(dirname "$LOG")"
sudo touch "$LOG"
sudo chmod 600 "$LOG"

exec > >(tee -a "$LOG") 2>&1

log() {
    printf '%s - %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$*"
}

step() {
    printf '\n[%s] STEP %s/9 - %s\n' "$(date '+%H:%M:%S')" "$1" "$2"
}

fail() {
    log "ERROR: $*"
    exit 1
}

###############################################################################
# RESTART CONTAINERS ON EXIT OR ERROR
###############################################################################

HOMEY_WAS_RUNNING=0

restore_containers() {
    local rc=$?

    log "Running cleanup..."

    if [["$HOMEY_WAS_RUNNING" == 1]]; then
        if docker start "$HOMEY_CONTAINER" >/dev/null 2>&1; then
            log "Homey SHS restarted"
        else
            log "WARNING: Homey SHS could not be restarted"
        fi
    fi

    if [["$rc" -eq 0]]; then
        log "=== MAINTENANCE COMPLETE ==="
    else
        log "Maintenance terminated with error code $rc"
    fi

    exit "$rc"
}

trap restore_containers EXIT

###############################################################################
# STARTUP CHECKS
###############################################################################

step 1 "Startup checks"
log "=== MAINTENANCE START ==="

mountpoint -q "$MOUNT" || fail "$MOUNT is not mounted"
sudo mkdir -p "$BACKUP_DIR" "$INFO_DIR"
command -v docker >/dev/null 2>&1 || fail "docker is not available"
[[-d "$HOMEY_DATA"]] || fail "Homey SHS directory does not exist: $HOMEY_DATA"

###############################################################################
# COLLECT OPTIONAL DIRECTORIES
###############################################################################

step 2 "Collect optional directories"

OPTIONAL_PATHS=()

for path in "$DOCKER_DIR" "$SCRIPTS_DIR" "$COMPOSE_DIR"; do
    if [[-d "$path"]]; then
        if [[! " ${OPTIONAL_PATHS[*]} " =~ " ${path} " ]]; then
            OPTIONAL_PATHS+=("$path")
        fi
        log "Optional directory found: $path"
    else
        log "Optional directory skipped: $path"
    fi
done

###############################################################################
# PRESERVE ORIGINAL CONTAINER STATUS
###############################################################################

step 3 "Preserve container status"

if docker inspect "$HOMEY_CONTAINER" >/dev/null 2>&1; then
    if [["$(docker inspect -f '{{.State.Running}}' "$HOMEY_CONTAINER")" == "true"]]; then
        HOMEY_WAS_RUNNING=1
    fi
else
    log "WARNING: container does not exist: $HOMEY_CONTAINER"
fi

###############################################################################
# BACK UP SYSTEM CONFIGURATION
###############################################################################

step 4 "Back up system configuration"

sudo tar \
    --ignore-failed-read \
    --xattrs \
    --acls \
    --numeric-owner \
    -czf "$BACKUP_DIR/system-$DATE.tar.gz" \
    -C / \
    etc \
    boot \
    -C "$USER_HOME" \
    .ssh \
    .config

log "System configuration saved"

###############################################################################
# SAVE SYSTEM INFORMATION AS TXT
###############################################################################

step 5 "Save system information"

{
    echo "=== DATE ==="
    date

    echo
    echo "=== HOSTNAME ==="
    hostnamectl 2>/dev/null || hostname

    echo
    echo "=== KERNEL ==="
    uname -a

    echo
    echo "=== OS ==="
    cat /etc/os-release

    echo
    echo "=== DISKS ==="
    lsblk -f

    echo
    echo "=== MOUNTS ==="
    findmnt

    echo
    echo "=== NETWORK ==="
    ip addr
    ip route

    echo
    echo "=== WIFI ==="
    iw dev 2>/dev/null || true
    nmcli device status 2>/dev/null || true
    nmcli connection show 2>/dev/null || true

    echo
    echo "=== ENABLED SERVICES ==="
    systemctl list-unit-files --state=enabled 2>/dev/null || true

    echo
    echo "=== ROOT CRONTAB ==="
    crontab -l 2>/dev/null || true

    echo
    echo "=== USER CRONTAB: $USER_NAME ==="
    sudo -u "$USER_NAME" crontab -l 2>/dev/null || true
} | sudo tee "$INFO_DIR/system-info-$DATE.txt" >/dev/null

sudo chmod 644 "$INFO_DIR/system-info-$DATE.txt" 2>/dev/null || true

###############################################################################
# DOCKER INFORMATION IN Backup_INFO
###############################################################################

step 6 "Save Docker information"

docker ps -a | sudo tee "$INFO_DIR/docker-containers-$DATE.txt" >/dev/null
docker image ls --no-trunc | sudo tee "$INFO_DIR/docker-images-$DATE.txt" >/dev/null
docker volume ls | sudo tee "$INFO_DIR/docker-volumes-$DATE.txt" >/dev/null
docker network ls | sudo tee "$INFO_DIR/docker-networks-$DATE.txt" >/dev/null

docker inspect \
    "$HOMEY_CONTAINER" \
    2>/dev/null \
    | sudo tee "$INFO_DIR/docker-inspect-$DATE.json" >/dev/null || true

sudo chmod 644 "$INFO_DIR/docker-containers-$DATE.txt" 2>/dev/null || true
sudo chmod 644 "$INFO_DIR/docker-images-$DATE.txt" 2>/dev/null || true
sudo chmod 644 "$INFO_DIR/docker-volumes-$DATE.txt" 2>/dev/null || true
sudo chmod 644 "$INFO_DIR/docker-networks-$DATE.txt" 2>/dev/null || true
sudo chmod 644 "$INFO_DIR/docker-inspect-$DATE.json" 2>/dev/null || true

###############################################################################
# STOP HOMEY SHS
###############################################################################

step 7 "Stop Homey SHS for backup and update"

if [["$HOMEY_WAS_RUNNING" == 1]]; then
    log "Stopping Homey SHS..."
    docker stop "$HOMEY_CONTAINER" >/dev/null 2>&1 || true
fi

###############################################################################
# HOMEY SHS BACKUP AND UPDATE
###############################################################################

step 8 "Back up and update Homey SHS"

sudo tar \
    --xattrs \
    --acls \
    --numeric-owner \
    -czf "$BACKUP_DIR/homey-shs-$DATE.tar.gz" \
    -C "$(dirname "$HOMEY_DATA")" \
    "$(basename "$HOMEY_DATA")"

log "Homey SHS backup saved"

log "Fetching new image..."
docker pull "$HOMEY_IMAGE"

log "Removing container if present..."
docker rm "$HOMEY_CONTAINER" >/dev/null 2>&1 || true

log "Starting new container..."
docker run \
  --name "$HOMEY_CONTAINER" \
  --network host \
  --privileged \
  --detach \
  --restart unless-stopped \
  --volume "$HOMEY_DATA":/homey/user/ \
  "$HOMEY_IMAGE"

sleep 5

if docker ps --format '{{.Names}}' | grep -qx "$HOMEY_CONTAINER"; then
    log "Homey SHS running again"
else
    fail "Homey SHS does not appear to have started correctly"
fi

###############################################################################
# CREATE AUTOMATION ARCHIVE
###############################################################################

step 9 "Create automation archive"

if [["${#OPTIONAL_PATHS[@]}" -gt 0 ]]; then
    TAR_ARGS=()

    for path in "${OPTIONAL_PATHS[@]}"; do
        TAR_ARGS+=(
            -C
            "$(dirname "$path")"
            "$(basename "$path")"
        )
    done

    log "Automation sources: ${OPTIONAL_PATHS[*]}"

    sudo tar \
        --ignore-failed-read \
        --xattrs \
        --acls \
        --numeric-owner \
        -czf "$BACKUP_DIR/automation-files-$DATE.tar.gz" \
        "${TAR_ARGS[@]}"

    log "Archive OK: automation-files-$DATE.tar.gz"
else
    log "No optional directories found; skipping automation-files archive"
fi

###############################################################################
# VERIFY AND CLEAN UP ARCHIVES
###############################################################################

log "Checking backup files..."

REQUIRED_ARCHIVES=(
    "$BACKUP_DIR/system-$DATE.tar.gz"
    "$BACKUP_DIR/homey-shs-$DATE.tar.gz"
)

for archive in "${REQUIRED_ARCHIVES[@]}"; do
    [[-s "$archive"]] || fail "Empty or missing archive: $archive"

    if tar -tzf "$archive" >/dev/null 2>&1; then
        log "Archive OK: $(basename "$archive")"
    else
        fail "Invalid tar archive: $archive"
    fi
done

if [[-f "$BACKUP_DIR/automation-files-$DATE.tar.gz"]]; then
    tar -tzf "$BACKUP_DIR/automation-files-$DATE.tar.gz" >/dev/null \
        || fail "Invalid automation archive"
fi

log "Cleaning up old tar.gz backups..."

cleanup_category() {
    local pattern="$1"
    local directory="$2"

    mapfile -t OLD_FILES < <(
        find "$directory" \
            -maxdepth 1 \
            -type f \
            -name "$pattern" \
            -printf '%T@ %p\n' |
        sort -rn |
        tail -n +$((KEEP + 1)) |
        cut -d' ' -f2-
    )

    for file in "${OLD_FILES[@]}"; do
        [[-f "$file"]] || continue
        rm -f -- "$file"
        log "Deleted: $file"
    done
}

cleanup_category "system-*.tar.gz" "$BACKUP_DIR"
cleanup_category "homey-shs-*.tar.gz" "$BACKUP_DIR"
cleanup_category "automation-files-*.tar.gz" "$BACKUP_DIR"
cleanup_category "*.txt" "$INFO_DIR"
cleanup_category "*.json" "$INFO_DIR"

log "Backup + update completed successfully"

```

---

<div class="post-metadata">

**Author:** ![Ruurd\_van\_der\_Noord](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ruurd_van_der_noord/32/71093_2.png) [@Ruurd\_van\_der\_Noord](https://community.homey.app/u/Ruurd_van_der_Noord)\
**Post date:** [September 29, 2026, 7:29am UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/54 "2026-09-29T07:29:07Z")

</div>

there is still some Dutch comment in the version above, translation below:

```auto
#!/usr/bin/env bash
# sudo ./backUpdate_Pi5_SHS_EN.sh
set -Eeuo pipefail

###############################################################################
# CONFIGURATION
###############################################################################

DATE="$(date +%Y%m%d-%H%M%S)"

MOUNT="/mnt/pi5-T7B"
BACKUP_DIR="$MOUNT/Backup4/Pi5_Backup"
INFO_DIR="$BACKUP_DIR/Backup_INFO"
KEEP=31
LOG="/var/log/backup-pi5-opi.log"

USER_NAME="YOUR_USERNAME"
USER_HOME="/home/$USER_NAME"

HOMEY_CONTAINER="homey-shs"
HOMEY_IMAGE="ghcr.io/athombv/homey-shs"
HOMEY_DATA="$USER_HOME/.homey-shs"

DOCKER_DIR="$USER_HOME/homey-shs"
SCRIPTS_DIR="$USER_HOME/scripts"
COMPOSE_DIR="$USER_HOME/homey-shs"

###############################################################################
# LOGGING
###############################################################################

sudo mkdir -p "$(dirname "$LOG")"
sudo touch "$LOG"
sudo chmod 600 "$LOG"

exec > >(tee -a "$LOG") 2>&1

log() {
    printf '%s - %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$*"
}

step() {
    printf '\n[%s] STEP %s/9 - %s\n' "$(date '+%H:%M:%S')" "$1" "$2"
}

fail() {
    log "ERROR: $*"
    exit 1
}

###############################################################################
# RESTART CONTAINERS ON EXIT OR ERROR
###############################################################################

HOMEY_WAS_RUNNING=0

restore_containers() {
    local rc=$?

    log "Running cleanup..."

    if [["$HOMEY_WAS_RUNNING" == 1]]; then
        if docker start "$HOMEY_CONTAINER" >/dev/null 2>&1; then
            log "Homey SHS restarted"
        else
            log "WARNING: Homey SHS could not be restarted"
        fi
    fi

    if [["$rc" -eq 0]]; then
        log "=== MAINTENANCE COMPLETE ==="
    else
        log "Maintenance terminated with error code $rc"
    fi

    exit "$rc"
}

trap restore_containers EXIT

###############################################################################
# STARTUP CHECKS
###############################################################################

step 1 "Startup checks"
log "=== MAINTENANCE START ==="

mountpoint -q "$MOUNT" || fail "$MOUNT is not mounted"
sudo mkdir -p "$BACKUP_DIR" "$INFO_DIR"
command -v docker >/dev/null 2>&1 || fail "docker is not available"
[[-d "$HOMEY_DATA"]] || fail "Homey SHS directory does not exist: $HOMEY_DATA"

###############################################################################
# COLLECT OPTIONAL DIRECTORIES
###############################################################################

step 2 "Collect optional directories"

OPTIONAL_PATHS=()

for path in "$DOCKER_DIR" "$SCRIPTS_DIR" "$COMPOSE_DIR"; do
    if [[-d "$path"]]; then
        if [[! " ${OPTIONAL_PATHS[*]} " =~ " ${path} " ]]; then
            OPTIONAL_PATHS+=("$path")
        fi
        log "Optional directory found: $path"
    else
        log "Optional directory skipped: $path"
    fi
done

###############################################################################
# PRESERVE ORIGINAL CONTAINER STATUS
###############################################################################

step 3 "Preserve container status"

if docker inspect "$HOMEY_CONTAINER" >/dev/null 2>&1; then
    if [["$(docker inspect -f '{{.State.Running}}' "$HOMEY_CONTAINER")" == "true"]]; then
        HOMEY_WAS_RUNNING=1
    fi
else
    log "WARNING: container does not exist: $HOMEY_CONTAINER"
fi

###############################################################################
# BACK UP SYSTEM CONFIGURATION
###############################################################################

step 4 "Back up system configuration"

sudo tar \
    --ignore-failed-read \
    --xattrs \
    --acls \
    --numeric-owner \
    -czf "$BACKUP_DIR/system-$DATE.tar.gz" \
    -C / \
    etc \
    boot \
    -C "$USER_HOME" \
    .ssh \
    .config

log "System configuration saved"

###############################################################################
# SAVE SYSTEM INFORMATION AS TXT
###############################################################################

step 5 "Save system information"

{
    echo "=== DATE ==="
    date

    echo
    echo "=== HOSTNAME ==="
    hostnamectl 2>/dev/null || hostname

    echo
    echo "=== KERNEL ==="
    uname -a

    echo
    echo "=== OS ==="
    cat /etc/os-release

    echo
    echo "=== DISKS ==="
    lsblk -f

    echo
    echo "=== MOUNTS ==="
    findmnt

    echo
    echo "=== NETWORK ==="
    ip addr
    ip route

    echo
    echo "=== WIFI ==="
    iw dev 2>/dev/null || true
    nmcli device status 2>/dev/null || true
    nmcli connection show 2>/dev/null || true

    echo
    echo "=== ENABLED SERVICES ==="
    systemctl list-unit-files --state=enabled 2>/dev/null || true

    echo
    echo "=== ROOT CRONTAB ==="
    crontab -l 2>/dev/null || true

    echo
    echo "=== USER CRONTAB: $USER_NAME ==="
    sudo -u "$USER_NAME" crontab -l 2>/dev/null || true
} | sudo tee "$INFO_DIR/system-info-$DATE.txt" >/dev/null

sudo chmod 644 "$INFO_DIR/system-info-$DATE.txt" 2>/dev/null || true

###############################################################################
# DOCKER INFORMATION IN Backup_INFO
###############################################################################

step 6 "Save Docker information"

docker ps -a | sudo tee "$INFO_DIR/docker-containers-$DATE.txt" >/dev/null
docker image ls --no-trunc | sudo tee "$INFO_DIR/docker-images-$DATE.txt" >/dev/null
docker volume ls | sudo tee "$INFO_DIR/docker-volumes-$DATE.txt" >/dev/null
docker network ls | sudo tee "$INFO_DIR/docker-networks-$DATE.txt" >/dev/null

docker inspect \
    "$HOMEY_CONTAINER" \
    2>/dev/null \
    | sudo tee "$INFO_DIR/docker-inspect-$DATE.json" >/dev/null || true

sudo chmod 644 "$INFO_DIR/docker-containers-$DATE.txt" 2>/dev/null || true
sudo chmod 644 "$INFO_DIR/docker-images-$DATE.txt" 2>/dev/null || true
sudo chmod 644 "$INFO_DIR/docker-volumes-$DATE.txt" 2>/dev/null || true
sudo chmod 644 "$INFO_DIR/docker-networks-$DATE.txt" 2>/dev/null || true
sudo chmod 644 "$INFO_DIR/docker-inspect-$DATE.json" 2>/dev/null || true

###############################################################################
# STOP HOMEY SHS
###############################################################################

step 7 "Stop Homey SHS for backup and update"

if [["$HOMEY_WAS_RUNNING" == 1]]; then
    log "Stopping Homey SHS..."
    docker stop "$HOMEY_CONTAINER" >/dev/null 2>&1 || true
fi

###############################################################################
# HOMEY SHS BACKUP AND UPDATE
###############################################################################

step 8 "Back up and update Homey SHS"

sudo tar \
    --xattrs \
    --acls \
    --numeric-owner \
    -czf "$BACKUP_DIR/homey-shs-$DATE.tar.gz" \
    -C "$(dirname "$HOMEY_DATA")" \
    "$(basename "$HOMEY_DATA")"

log "Homey SHS backup saved"

log "Fetching new image..."
docker pull "$HOMEY_IMAGE"

log "Removing container if present..."
docker rm "$HOMEY_CONTAINER" >/dev/null 2>&1 || true

log "Starting new container..."
docker run \
  --name "$HOMEY_CONTAINER" \
  --network host \
  --privileged \
  --detach \
  --restart unless-stopped \
  --volume "$HOMEY_DATA":/homey/user/ \
  "$HOMEY_IMAGE"

sleep 5

if docker ps --format '{{.Names}}' | grep -qx "$HOMEY_CONTAINER"; then
    log "Homey SHS running again"
else
    fail "Homey SHS does not appear to have started correctly"
fi

###############################################################################
# CREATE AUTOMATION ARCHIVE
###############################################################################

step 9 "Create automation archive"

if [["${#OPTIONAL_PATHS[@]}" -gt 0 ]]; then
    TAR_ARGS=()

    for path in "${OPTIONAL_PATHS[@]}"; do
        TAR_ARGS+=(
            -C
            "$(dirname "$path")"
            "$(basename "$path")"
        )
    done

    log "Automation sources: ${OPTIONAL_PATHS[*]}"

    sudo tar \
        --ignore-failed-read \
        --xattrs \
        --acls \
        --numeric-owner \
        -czf "$BACKUP_DIR/automation-files-$DATE.tar.gz" \
        "${TAR_ARGS[@]}"

    log "Archive OK: automation-files-$DATE.tar.gz"
else
    log "No optional directories found; skipping automation-files archive"
fi

###############################################################################
# VERIFY AND CLEAN UP ARCHIVES
###############################################################################

log "Checking backup files..."

REQUIRED_ARCHIVES=(
    "$BACKUP_DIR/system-$DATE.tar.gz"
    "$BACKUP_DIR/homey-shs-$DATE.tar.gz"
)

for archive in "${REQUIRED_ARCHIVES[@]}"; do
    [[-s "$archive"]] || fail "Empty or missing archive: $archive"

    if tar -tzf "$archive" >/dev/null 2>&1; then
        log "Archive OK: $(basename "$archive")"
    else
        fail "Invalid tar archive: $archive"
    fi
done

if [[-f "$BACKUP_DIR/automation-files-$DATE.tar.gz"]]; then
    tar -tzf "$BACKUP_DIR/automation-files-$DATE.tar.gz" >/dev/null \
        || fail "Invalid automation archive"
fi

log "Cleaning up old tar.gz backups..."

cleanup_category() {
    local pattern="$1"
    local directory="$2"

    mapfile -t OLD_FILES < <(
        find "$directory" \
            -maxdepth 1 \
            -type f \
            -name "$pattern" \
            -printf '%T@ %p\n' |
        sort -rn |
        tail -n +$((KEEP + 1)) |
        cut -d' ' -f2-
    )

    for file in "${OLD_FILES[@]}"; do
        [[-f "$file"]] || continue
        rm -f -- "$file"
        log "Deleted: $file"
    done
}

cleanup_category "system-*.tar.gz" "$BACKUP_DIR"
cleanup_category "homey-shs-*.tar.gz" "$BACKUP_DIR"
cleanup_category "automation-files-*.tar.gz" "$BACKUP_DIR"
cleanup_category "*.txt" "$INFO_DIR"
cleanup_category "*.json" "$INFO_DIR"

log "Backup + update completed successfully"

```

---

<div class="post-metadata">

**Author:** ![No-mind](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/no-mind/32/178712_2.png) [@No-mind](https://community.homey.app/u/No-mind)\
**Post date:** [October 17, 2026, 4:37pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/55 "2026-10-17T16:37:36Z")

</div>

I have the docker container installed and connected to the Android app. When I open the interface from a browser on Windows, my credentials are not accepted?

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 18, 2026, 9:41am UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/56 "2026-10-18T09:41:54Z")

</div>

First create a local account.  
Please search for howto @ support.homey.app

---

<div class="post-metadata">

**Author:** ![No-mind](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/no-mind/32/178712_2.png) [@No-mind](https://community.homey.app/u/No-mind)\
**Post date:** [October 18, 2026, 3:20pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/57 "2026-10-18T15:20:17Z")

</div>

I tried but the Android client does not accept a second login. And the admin account cannot be promoted to also be a local account. Do I need a 2nd Android device to be able to create a new account?

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 18, 2026, 4:16pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/58 "2026-10-18T16:16:07Z")

</div>

Please read this kb article. You’ll need to use my.homey.app

> **[Set up Local Users on Homey Pro](https://support.homey.app/hc/en-us/articles/22924537226268-Set-up-Local-Users-on-Homey-Pro)**
>
> Local Users let you sign in to the Homey Web App directly on your local network, even when the internet is down. This gives you access without relying on cloud authentication.You can set a local us...

 ![1000084988](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/c/5ce5c98de9e97b3f56a7e5e6ede4194d3c0fa47e.jpeg)

---

<div class="post-metadata">

**Author:** ![No-mind](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/no-mind/32/178712_2.png) [@No-mind](https://community.homey.app/u/No-mind)\
**Post date:** [October 18, 2026, 8:18pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/59 "2026-10-18T20:18:45Z")

</div>

I don’t have a Homey Pro. I have a selfhosted docker server and an android app that connects to it. But in the app I can’t grant users local access. The interface is not the same. I also can’t add another user because the app doesnot allow a 2nd user using the app on Android.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 19, 2026, 10:37pm UTC](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441/60 "2026-10-19T22:37:04Z")

</div>

OK, you somehow can’t, or just don’t, want to read info aimed for SHS (and yes, it’s also applicable to Homey Pro).  
A detail from the article I linked to, and as screenshotted as well:

 ![Screenshot_20261020_003437_Ecosia](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/e/8ed7f2fd5e2113d67ac385cf176d48ca6bbabd42.jpeg)

I’m out.

[Previous page](https://community.homey.app/t/homey-self-hosted-server-with-docker-on-linux-megathread/146441.md?page=2)
