0
votes

I am trying to push a custom docker image (not C/C#) to an Azure IOT Edge device from Azure IOT HUB. The docker image runs without exiting when run manually. e.g. docker run -itd is perfectly fine. When the module is published via IOT Hub, it continually shows a status of backup/and is restarting always. The full code of the docker file is as follows:

FROM alpine                                                                     
RUN apk -U -u add sqlite && \                                                       
mkdir -p /db && \ 
rm -rf /var/lib/apt/lists/*                                                 
#RUN /usr/bin/sqlite3 /db/arf.sqlite                                            
CMD /bin/sh                                                                                        

The custom create options are as follows:

{
    "Env": [],
    "HostConfig": {
        "Binds": [
            "/work:/db"
        ]
    }
}

There are no specific module twin setting and hence I am passing it as

{} 

I am attaching a screen shot that (hopefully) explains this better. enter image description here

1

1 Answers

0
votes

I figured this out. When running manually, I was running with -itd flags to run in daemonized mode. When publishing to azure Hub, it ran the /bin/bash as specified in CMD and exited.

Cruel Workaround: Add a run.sh that just does nothing. I hate this solution - but it works.

while :; do 
sleep 1000
done 

What would be nice Is it possible to specify anywhere in the IOT Module Metadata to run in daemon mode so that the edge device can pass -d when starting the module?