@@ -57,6 +57,7 @@ See [`config.sample.json`](https://github.com/willfarrell/docker-crontab/blob/ma
5757## How to use
5858
5959### Command Line
60+
6061``` bash
6162docker build -t crontab .
6263docker run -d \
@@ -67,7 +68,19 @@ docker run -d \
6768 crontab
6869```
6970
71+ ### Use with docker-compose
72+
73+ 1 . Figure out which network name used for your docker-compose containers
74+ * use `docker network ls` to see existing networks
75+ * if your `docker-compose.yml` is in `my_dir` directory, you probably has network `my_dir_default`
76+ * otherwise [read the docker-compose docs](https://docs.docker.com/compose/networking/)
77+ 2 . Add ` dockerargs ` to your docker-crontab ` config.json `
78+ * use `--network NETWORK_NAME` to connect new container into docker-compose network
79+ * use `--rm --name NAME` to use named container
80+ * e.g. `"dockerargs": "--network my_dir_default --rm --name my-best-cron-job"`
81+
7082### Dockerfile
83+
7184``` Dockerfile
7285FROM willfarrell/crontab
7386
@@ -76,6 +89,7 @@ COPY config.json ${HOME_DIR}/
7689```
7790
7891### Logrotate Dockerfile
92+
7993``` Dockerfile
8094FROM willfarrell/crontab
8195
@@ -87,13 +101,13 @@ CMD ["crond", "-f"]
87101```
88102
89103### Logging - In Dev
104+
90105All ` stdout ` is captured, formatted, and saved to ` /var/log/crontab/jobs.log ` . Set ` LOG_FILE ` to ` /dev/null ` to disable logging.
91106
92107example: ` e6ced859-1563-493b-b1b1-5a190b29e938 2017-06-18T01:27:10+0000 [info] Start Cronjob **map-a-vol** map a volume `
93108
94109grok: ` CRONTABLOG %{DATA:request_id} %{TIMESTAMP_ISO8601:timestamp} \[%{LOGLEVEL:severity}\] %{GREEDYDATA:message} `
95110
96-
97111## TODO
98112- [ ] Have ability to auto regenerate crontab on file change (signal HUP?)
99113- [ ] Run commands on host machine (w/ --privileged?)
0 commit comments