Issue starting docker on reboot in Mac OS using Monit

Hello,

I am trying to use Monit to start docker and load container on Mac reboot. There are multiple problems I am facing and its very random.

Most of the time I got following error.

below is my monit config file and script which starts docker

CHECK PROCESS docker-desktop MATCHING "Docker.app"
                start program = "/usr/bin/su some_user /opt/monit/scripts/startDockerDesktop.sh" with timeout 600 seconds
      stop program = "/usr/bin/su some_user /opt/monit/scripts/stopDockerDesktop.sh"

startDockerDeskotp.sh

#!/bin/zsh

/Applications/Docker.app/Contents/MacOS/Docker

if [ ! -f “/usr/local/bin/docker” ]; then

echo "docker executable not found"

exit 1

fi

startup_status=-1

while [ $startup_status -ne 0 ]; do

sleep 5

/usr/local/bin/docker ps | grep -q IMAGE

startup_status=$?

done

MAC OS F*ckable :smiley: