So I have a simple python script that is set to run on startup. This script ideally runs a webhook that then runs a docker container upon a received POST request. This script works perfectly fine when I run it, but when I put it in my crontab, it all of a sudden doesn’t seem to work and I can’t completely figure out why. I have the script set to wall a message upon receiving a successful post method, so I know that isn’t the problem as I see the wall message just fine whenever I send a POST. It just doesn’t seem to actually start the container, no matter whether I tell it to run in the background, normally, with subprocess.Popen or with subprocess.call, with shell true or false.
subprocess.call(["echo PULLING APP | wall"], shell=True) subprocess.call([". [pathtoscript], shell=True)
This is the excerpt of the .py. It may be somewhat useful to note that I don’t test the script until the computer is fully booted up, to ensure that I am not somehow running this before the docker service starts or something like that.
#!/bin/sh docker run --name [app] -p 80:80 --rm --mount type=bind,source=/home/dev/mongodb.pass,target=/app/mongodb.pass [pathtoimage]