tiistai 19. syyskuuta 2017

Docker, Alpine and dillon's cron: "setpgid: Operation not permitted"

For a while, I've been strugling to get dillon's cron working properly in Docker container. The problem has been that when the ENTRYPOINT was anything else than in shell form, I got 'setpgid: Operation not permitted'.

So, this worked:
ENTRYPOINT /usr/sbin/crond -f
None of these seemed to work:
ENTRYPOINT ["/usr/sbin/crond", "-f"]
Or
ENTRYPOINT ["./entrypoint.sh"]
CMD ["/usr/sbin/crond", "-f"]
 As both would give
setpgid: Operation not permitted
But using shell form has been enough, for now. Now as I finally needed to have entrypoint for doing some preparation work, something had to be done.

"su -c" to the rescue.

ENTRYPOINT ["./entrypoint.sh"]
CMD ["su", "-c", "/usr/sbin/crond -f"]
Seems to be working perfectly.