Hi,
We are using a VOXL flight deck with LTE and require that the drone starts some c++ logic inside a container on start up. We have done this through the docker-autorun.service file below -
[Unit]
After=docker-daemon.service
Requires=docker-daemon.service
[Service]
Type=forking
ExecStartPre=/usr/bin/docker-prepare.sh
ExecStart=/etc/modalai/docker-autorun-script.sh
#ExecStop=/bin/bash -c "docker kill $(docker ps -q)"
[Install]
WantedBy=default.target
Then inside the docker-autorun-script.sh we have the following -
echo "initializing primevoxl"
((count =60))
while [[ $count -ne 0 ]] ; do
ping -c 1 8.8.8.8 # Try once.
rc=$?
if [[ $rc -eq 0 ]] ; then
((count = 1)) # If okay, flag loop exit.
else
sleep 1 # Minimise network storm.
fi
((count = count - 1)) # So we don't go forever.
done
if [[ $rc -eq 0 ]] ; then # Make final determination.
docker run -i --restart=always --privileged --net=host primevoxl &
else
echo "Timeout"
fi
The code does a ping test then on success runs a docker container via -
docker run -i --restart=always --privileged --net=host primevoxl &
The docker image ends with starting a piece of c++ code via a CMD in the dockerfile. The code that we run inside the container is a simple pubsub code with AWS IoT core to listen for missions etc. this works fine with no errors when i run the container normally and even when i run /etc/modalai/docker-autorun-script.sh it works fine and gets a connection.
But when the docker-autorun-script.sh is started with the service file on reboot we get the following error -
![error-code.jpg](/assets/uploads/files/1648472890689-error-code.jpg)
I cant seem to see where the error lies and whether i am starting the container correctly via service ?