Skip to content

Installation with Docker

About

swarm-cronjob provides automatically updated Docker 🐳 images in several registries:

Registry Image
Docker Hub crazymax/swarm-cronjob
GitHub Container Registry ghcr.io/crazy-max/swarm-cronjob

You can use the latest stable tag or rely on another service to keep Docker images up to date.

Note

Want to be notified of new releases? Check out 🔔 Diun (Docker Image Update Notifier) project!

The following platforms are available for this image:

$ docker run --rm mplatform/mquery crazymax/swarm-cronjob:latest
Image: crazymax/swarm-cronjob:latest
 * Manifest List: Yes
 * Supported platforms:
   - linux/amd64
   - linux/arm/v6
   - linux/arm/v7
   - linux/arm64
   - linux/386
   - linux/ppc64le

Usage

services:
  swarm-cronjob:
    image: crazymax/swarm-cronjob
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
    environment:
      - "TZ=Europe/Paris"
      - "LOG_LEVEL=info"
      - "LOG_JSON=false"
    deploy:
      placement:
        constraints:
          - node.role == manager

Edit this example with your preferences and deploy the stack:

docker stack deploy -c swarm_cronjob.yml swarm_cronjob

Or use the following command:

docker service create --name swarm_cronjob \
  --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
  --env "LOG_LEVEL=info" \
  --env "LOG_JSON=false" \
  --constraint "node.role == manager" \
  crazymax/swarm-cronjob

You are now ready to deploy cronjob-based services with Swarm.