Building my first Image for HomeSeer 4 / Raspberry Pi 4

Hello,

I’m attempting to dockerize HomeSeer 4 for the Raspberry Pi. Partly for security but mostly because I want to learn more about Docker. I’m having 2 issues that I can’t seem to get past and was hoping you could help. Please keep in mind that I’m both a Docker & Linux newb.

Here is what I have so far, and why.

OS / Rasbian - Buster

I downloaded the compressed HS4 install file and extracted it to /dockerbuild/homeseer
I created a Dockerfile with the following contents:

FROM arm32v7/python:3
RUN apt-get update &&
apt-get install -y --no-install-recommends
mono-complete
mono-vbnc
mono-xsp4
COPY HomeSeer /homeseer
cmd [“mono /homeseer/HSConsole.exe”]

I ran docker build -t “homeseer_rpi4:v1” . it provides the following error message "

E: Unable to locate package mono-vbnc
The command ‘/bin/sh -c apt-get update && apt-get install -y --no-install-recommends mono-complete mono-vbnc mono-xsp4’ returned a non-zero code: 100

I’m able to install mono-vbnc just fine by running apt install mono-vbnc while not building the image so I have no idea how to troubleshoot this. I decided to remove the line for now to see what happens.

The image is created successfully!
Sending build context to Docker daemon 105.5MB
Step 1/4 : FROM arm32v7/python:3
—> 68694196f670
Step 2/4 : RUN apt-get update && apt-get install -y --no-install-recommends mono-complete mono-xsp4
—> Using cache
—> 94c9093b645a
Step 3/4 : COPY HomeSeer /homeseer
—> cf283648812e
Step 4/4 : CMD [“mono /homeseer/HSConsole.exe”]
—> Running in 7c55e0eeee51
Removing intermediate container 7c55e0eeee51
—> 38739d2feaaa
Successfully built 38739d2feaaa
Successfully tagged homeseer_rpi4:v1

I know it won’t work without mono-vbnc but I try to run it anyway. I get the following error message:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: “mono /homeseer/HSConsole.exe”: stat mono /homeseer/HSConsole.exe: no such file or directory: unknown.
ERRO[0001] error waiting for container: context canceled

I tried a bunch of combinations in the CMD field to no avail. So I checked out the file system of the image by using docker run -it --entrypoint sh homeseer_rpi4:v1 and I’m able to see /homeseer/HSConsole.exe just fine.

I guess it’s possible the error is caused by not having the VBNC dependency but when I run mono /homeseer/HSConsole.exe inside the image it gives me a very different, but predictable error.

Unhandled Exception:
System.TypeLoadException: Could not load type of field ‘HSConsole.My.MyProject:m_ComputerObjectProvider’ (0) due to: Could not load file or assembly ‘Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies.
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type of field ‘HSConsole.My.MyProject:m_ComputerObjectProvider’ (0) due to: Could not load file or assembly ‘Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies.

So I don’t know what to do next. I need to fix both problems before I even try to build a container. Can anyone help?

On a side note - I read that I need a base to build my image, so I picked arm32v7/python:3. My image seems quite large (1.1gb) considering HS4 is under 50mb. Is there something else I can use that would get the job done and keep my image small?

Ok, I figured out the CMD issue. The proper format is:
CMD [ “mono”, “./homeseer/HSConsole.exe” ]

Now I’m back to the VBNC issue.

This is how I solved in an LXC container.

root@homeseer1:~# apt-get update
root@homeseer1:~# apt-get install mono-devel mono-vbnc
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
E: Unable to locate package mono-vbnc
root@homeseer1:~# sudo apt install dirmngr gnupg apt-transport-https ca-certificates
root@homeseer1:~# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
root@homeseer1:~# sudo sh -c ‘echo “deb Index of /repo/debian stable-buster main” > /etc/apt/sources.list.d/mono-official-stable.list’
root@homeseer1:~# apt-get update
root@homeseer1:~# apt-get install mono-complete

Source: