openHAB co-existing with Asterisk & FreePBX on Raspberry Pi 3B

Thought I would bring this uptodate with my experience.

I installed the Rasbian+Asterisk/FreePBX image from RasPBX images based on Raspbian 10 Buster and this went well. I started FreePBX OK but have yet to configure it and run it for real.

I then followed this guide Installing Docker and Docker Compose on the Raspberry Pi in 5 Simple Steps changing python and python-pip to version 3 mixing it with this extra steps in this guide Happy Pi Day with Docker and Raspberry Pi. but ignoring the swarm section. All went well.

Next I installed Portainer just the Quick Start section - 2 lines! Portainer is a web based front end to Docker.

Next I tried to install openHAB but ran out of space. I didn’t realise the Raspbian+Asterisk+FreePBX image is 4GB so it only filled 25% of my micro SD card. Anyway I had planned to utilise a 230GB SSD drive so followed this How to Run Raspberry Pi 4 or 3 Off an SSD or Flash Drive splitting the drive into 3 thirds circa 75GB each.

Next I installed openHAB following this guide https://community.openhab.org/t/running-openhab-2-in-docker/14267. It’s a bit dated and I stopped before " Create the openHAB conf, userdata, and addon directories" as I was unsure where to create them.

I found that Portainer had created a folder in var/lib/docker/volumes/ so I created a folder openhab_data as well and modified the docker run command -v lines to read:

        -v /var/lib/docker/volumes/openhab_data/openhab_addons:/openhab/addons \
        -v /var/lib/docker/volumes/openhab_data/openhab_conf:/openhab/conf \
        -v /var/lib/docker/volumes/openhab_data/openhab_userdata:/openhab/userdata \

I ran this command and created a openhab container that was listed in Portainer (after reloading the page).

I then followed OpenHAB Docker Containers from section “Running from compose-file.yml” part 2 “for use with Docker Volumes” and created a compose file “openhab-compose-file.yml” in my openhab_data folder

version: '2.2'

services:
  openhab:
    image: "openhab/openhab:2.4.0"
    restart: always
    network_mode: host
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/timezone:/etc/timezone:ro"
      - "/var/lib/docker/volumes/openhab_data/openhab_addons:/openhab/addons"
      - "/var/lib/docker/volumes/openhab_data/openhab_conf:/openhab/conf"
      - "/var/lib/docker/volumes/openhab_data/openhab_userdata:/openhab/userdata"
    environment:
      OPENHAB_HTTP_PORT: "8080"
      OPENHAB_HTTPS_PORT: "8443"
      EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/London"

volumes:
  openhab_addons:
    driver: local
  openhab_conf:
    driver: local
  openhab_userdata:
    driver: local

In Portainer I removed the openhab container and then ran this compose script with “docker-compose -f openhab-compose-file.yml up -d”

Only problem is that this creates a container called “openhab_data_openhab_1” which is a bit messy. Still trying to figure out why the run command creates a container named “openhab” but the compose script creates a container named “openhab_data_openhab_1”

Help appreciated.
Alan