Hi,
I’m trying to Dockerize Iot Edge v2 so that I can run it on BelenaOS (something similar has been done for v1: GitHub - maxtheaviator/resin-azure-iotedge-multicontainer: Combination of Resin.io and Microsoft Aure IoT Edge Device functionality)
The instruction I have are :
you can create a base container using one of the OSes in IoT Edge supported platforms | Microsoft Learn , install the package into it, and set up the entrypoint + config to run it without systemd (*). Also ensure the Docker socket from the host is mounted inside the container.
() Specifically, you want to mount the homedir on the host so that it can be remounted inside modules, and you want to use UDS unix:// URIs for the listen. endpoints instead of fd:// since it won’t be running under systemd.
And this is the Dockerfile I’m building:
FROM amd64/debian
RUN apt-get update
RUN apt-get install --yes curl wget
# install balena
RUN wget --no-check-certificate https://github.com/balena-os/balena-engine/releases/download/v18.9.7/balena-engine-v18.$
RUN tar -xzf balena-engine-v18.9.7-armv7.tar.gz
# create docker "symlink"
COPY docker /usr/local/bin
RUN chmod +x /usr/local/bin/docker
# install iotedge.deb
RUN curl -L https://github.com/Azure/azure-iotedge/releases/download/1.0.8-rc3/libiothsm-std_1.0.8.rc3-1_amd64.deb -o libiothsm-std.deb
RUN dpkg -i ./libiothsm-std.deb
RUN curl -L https://github.com/Azure/azure-iotedge/releases/download/1.0.8-rc3/iotedge_1.0.8.rc3-1_amd64.deb -o iotedge.deb
RUN dpkg -i ./iotedge.deb
# edit config file for iotedge
WORKDIR /etc/iotedge
RUN sed -i '/device_connection_string/c\ device_connection_string : \"'$DEVICE_CONNECTION_STRING'\"' ./config.yaml
RUN sed -i '/docker.sock/c\ uri: \"unix:///var/run/balena.sock\"' ./config.yaml
What I’m doing here is to install the balena engine (instead of moby-engine as specified in the Microsoft documentation), install the iotedge.deb package and then update the config file with the DEVICE_CONNECTION_STRING
and also use balena.sock instead of docker.sock.
I don’t know if this beginning of Dockerfile is correct. Please correct it if needed.
Can someone please explain to me particularly what do I need to do for this:
set up the entrypoint + config to run it without systemd (*). Also ensure the Docker socket from the host is mounted inside the container.
() Specifically, you want to mount the homedir on the host so that it can be remounted inside modules, and you want to use UDS unix:// URIs for the listen. endpoints instead of fd:// since it won’t be running under systemd.
I have also a `docker-compose.yml’ (taken from GitHub - maxtheaviator/resin-azure-iotedge-multicontainer: Combination of Resin.io and Microsoft Aure IoT Edge Device functionality) :
version: '2.1'
services:
iotedge:
build:
context: ./iotedge
restart: 'yes'
pid: "host"
volumes:
- 'resin-data:/data'
- /var/run/:/var/run/
labels:
io.resin.features.balena-socket: '1'
# persistent for reboot:
volumes:
resin-data:
Where I added - /var/run/:/var/run/
But I have the error:
[Error] Could not parse compose file
[Error] Bind mounts are not allowed
[Error] Not deploying release.
If I don’t use the docker-compose file (just push the Dockerfile), I have the following error:
[main] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[main] ERROR: No container runtime detected.
[main] Please install a container runtime and run this install again.
[main] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I guess there is something to do to tell iotedge to use balena-engine instead of moby, but I don’t know how to do it.
Could you please help?
Thanks