{"id":20872764,"url":"https://github.com/zalari/docker-docker-cron","last_synced_at":"2026-03-17T07:37:57.110Z","repository":{"id":81977584,"uuid":"234099756","full_name":"zalari/docker-docker-cron","owner":"zalari","description":"This is simple docker image including docker itself and cron for running docker with cron.","archived":false,"fork":false,"pushed_at":"2020-01-16T11:27:23.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-12T15:50:41.053Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zalari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-15T14:36:12.000Z","updated_at":"2020-01-16T11:27:26.000Z","dependencies_parsed_at":"2023-03-12T14:29:24.993Z","dependency_job_id":null,"html_url":"https://github.com/zalari/docker-docker-cron","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zalari/docker-docker-cron","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalari%2Fdocker-docker-cron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalari%2Fdocker-docker-cron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalari%2Fdocker-docker-cron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalari%2Fdocker-docker-cron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zalari","download_url":"https://codeload.github.com/zalari/docker-docker-cron/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalari%2Fdocker-docker-cron/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28077395,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-27T02:00:05.897Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T06:20:49.549Z","updated_at":"2025-12-27T10:03:39.997Z","avatar_url":"https://github.com/zalari.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-cron\nThis is docker image for running cronjobs via a container. Its main purpose is, to trigger other docker containers via cron.\n\nA possible use case are backups - you want to have regular backups for you dockerized application stack with neither setting up a cronjob **inside** your _database_ container nor setting up cron on the _host_.\n\nWith this container you can easily achieve this, by exposing the docker socket from the host to this container and setting up cronjobs via an _environment variable_.\n\n## Usage\n\nFor setting up cronjobs, you have to pass an _environment variable_ `DOCKER_CRONTAB` to it - it can be _\"multi-line\", i.e. contain multiple entries by separating them with `\\n`.\n\nAlthough you can run arbitrary commands _inside_ this container, you likely want to run some sort of docker command _from inside_ the container communicating with the _outside_ docker daemon, for this you have to pass the docket socket to it.\n\n```bash\ndocker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro \\\n       -e DOCKER_CRONTAB=\\\n       '*/5       *       *       *       *       docker info \u003e /cron-env/docker-info.txt' \\\n       zalari/docker-cron\n```\n\n### with docker-compose\n`docker-compose` is also conveniently provided in this image and this allows for adding cron functionality quite easily to your applications stacks:\n\n```yaml\n  # ...\n\n  #this is a special service for exporting something to stdout\n  #to use: docker-compose run --rm -T dump_db_out \u003e db_dump/dump.sql\n  dump_db_out:\n    image: mysql:5\n    # usually you would want some more params for mysqldump\n    command: mysqldump\n    depends_on:\n      - db\n   \n  \n  cron:\n    image: zalari/docker-cron\n    volumes:\n      - ./docker-compose.yml:/cron-env/project/docker-compose.yml\n      - ./db_dump:/cron-env/project/db_dump\n      - /var/run/docker.sock:/var/run/docker.sock\n    environment:\n      - |\n        DOCKER_CRONTAB=\n        30       22       *       *       * cd /cron-env/project \u0026\u0026 docker-compose run --rm -T dump_db_out \u003e db_dump/`date +\"%m-%d-%y\"`-project.sql\n        30       22       *       *       * cd /cron-env/project/db_dump \u0026\u0026 find *.sql -mtime +30 -delete\n\n  \n```\n\n## Hints\nThe image is based on the _rather latest_ `alpine` image and thus _only_ **BusyBox** and **ash** are available for cronjobs; if you need more tooling, simply base your image off this one.\n\nYou can also use the _default cronjobs_ from `alpine` if you either _add_ something or _bind-mount_ to the following dirs _in_ the container:\n* `/etc/periodic/15min`\n* `/etc/periodic/hourly`\n* `/etc/periodic/daily`\n* `/etc/periodic/weekly`\n* `/etc/periodic/monthly`\n\nFor listing the actual `crontab` of the _running_ container, simply run: `docker exec container-name cat /var/spool/cron/crontabs/root`\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzalari%2Fdocker-docker-cron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzalari%2Fdocker-docker-cron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzalari%2Fdocker-docker-cron/lists"}