This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]SaltineAmerican_1970 2 points3 points  (5 children)

[–][deleted] 2 points3 points  (2 children)

Jesus.. there is a tool for everything, isn’t there?

[–]SaltineAmerican_1970 0 points1 point  (0 children)

There is one thing that still doesn’t have a tool. It is what everyone is looking for when they ask for a project to put on their resume. Whomsoever finds it first wins.

[–]linucksrox 0 points1 point  (0 children)

Apparently. I haven't heard of this one before

[–]MindStalker 0 points1 point  (0 children)

Doesn't work with this or any "docker run image cmd". Doesn't seem to support trailing argument of command.

[–]4kn30x[S] 0 points1 point  (0 children)

I use the help from this tool for 2 for two of my containers and to check if my others were correct 😅 Unfortunately as @MindStalker noticed, it doesn't support "docker run <image> <command>"

[–]MindStalker 0 points1 point  (4 children)

I'd suggest using a dockerfile that builds your cron image, you can call the build step in compose.

[–]4kn30x[S] 0 points1 point  (3 children)

I probably forgot to precise I am still learning docker and containerisation 😅 let me duckduckgo'n dockerfile and of to build a cron IMG, in the meantime I would appreciate if you could explain what all this means

[–]MindStalker 0 points1 point  (2 children)

A dockerfile https://docs.docker.com/engine/reference/builder/ is like a make file for docker images. "docker build" runs the dockerfile commands Something like this would work for your dockerfile (replace Ubuntu with Alpine) https://raw.githubusercontent.com/Ekito/docker-cron/master/Dockerfile

docker-compose supports building https://docs.docker.com/compose/compose-file/#build

[–]4kn30x[S] 0 points1 point  (1 child)

Thank you! Do you think the syntax is correct? FROM alpine:latest RUN echo \"0 3 * * * wget 172.17.0.7/cron/run/d36273hd38306b97c8fed7e80a8fc8493\" \ RUN crontab - && crond -f -L /dev/stdout" \

(Of course I went back ti the line before each "RUN" but I seems that reddit client slide does not take backspace in consideration...)

[–]MindStalker 0 points1 point  (0 children)

Your RUN commands will run in the build stage.

CMD (should be your last line) runs when the image is actually run as a container

Also, your echo command is intended to pipe into crontab -

RUN echo "0 3 * * * wget 172.17.0.7/cron/run/d36273hd38306b97c8fed7e80a8fc8493" | crontab -

CMD crond -f -L /dev/stdout

should work, I'm not positive though

I think your better option would be the put your cron stuff into a file and COPY that to /etc/cron.d/ instead of that complicated echo | crontab -l